Git version in the terminal is not the same as in Visual Studio Code

1.8k views Asked by At

I tried to update Git on Mac terminal by using Homebrew (brew) and everything looked good except the directory was different in the terminal. Command "which git" gives me /opt/homebrew/bin/git, and the version is 2.34.

But in Visual Studio Code it says /usr/bin/git. Here the version is 2.30.

How I can solve this problem?

1

There are 1 answers

9
VonC On BEST ANSWER

Check if the setting "Git Path" was set directly to /usr/bin/git.

VSCode settings

If so, you can delete that setting: VSCode will pick up git from the $PATH.

As long as which git displays /opt/homebrew/bin/git before /usr/bin/git, you will be OK.

The OP MadCodex adds in the comments:

I just deleted the brew git and everything come to normal again

I would not recommend that "solution", as the brew git is the one which is supposed to be here.

From the discussion, adding export PATH="/opt/homebrew/bin:$PATH" in ~/.zshr and relaunching VSCode was enough.