Check that VS Code and IntelliJ see Git
Beginner Git CLI VS Code UI IntelliJ UI
Why this matters
An IDE does not contain Git; it runs the one installed on your computer. When it cannot find it, or finds a different one than your terminal, the Source Control view is empty or behaves oddly, and beginners blame themselves. Two checks, once.
Find the path first
In the terminal, note what which git prints (lesson 3.2). That is the executable both IDEs should use:
- macOS:
/usr/bin/gitor/opt/homebrew/bin/git - Windows:
C:\Program Files\Git\cmd\git.exe(this is the one to give to IDEs, notbin\git.exe) - Linux:
/usr/bin/git
Check each tool
$ which git/usr/bin/git$ git config --global user.nameAna LopezBoth IDEs should report the same executable and the same identity.
- Open any repository folder (the playground). Open Source Control (Ctrl+Shift+G / ⌃⇧G). A branch name in the status bar and a list of changes (or "no changes") means Git was found.
- If VS Code shows Git not found or the view offers only "Install Git": open Settings (Ctrl+, / ⌘,), search
git.path, click Edit in settings.json, and add the path fromwhich git, for example"git.path": "/opt/homebrew/bin/git"or"git.path": "C:\\Program Files\\Git\\cmd\\git.exe"(double backslashes on Windows). - Run Developer: Reload Window from the Command Palette.
- Check the identity: open the integrated terminal and run
git config --global user.name. VS Code's commits use it.
- Settings → Version Control → Git (on macOS IntelliJ IDEA → Settings).
- Path to Git executable: leave Auto-detect if it shows a path and the Test button reports a version. Otherwise untick auto-detect and enter the path from
which git. - Click Test. Expect "Git version is 2.50.1" or similar.
- Keep Use credential helper ticked so IntelliJ reuses the credentials stored by Git.
- Identity comes from
~/.gitconfig; the commit dialog's Author field should stay empty.
Not applicable: GitLab runs on a server and has its own Git. What matters for GitLab is that the email in your commits matches your profile (lesson 3.3).
Not applicable either. If you use GitHub Desktop as well, be aware it ships its own private Git; the IDEs and the terminal should still point at the system Git.
Common mistakes
- Pointing IntelliJ at the Git folder instead of the executable. The field wants the file (
git.exeorgit), not the folder that contains it. - Editing
git.pathwith single backslashes on Windows. JSON needs\\. - Two different Gits. The terminal uses Homebrew's, the IDE Apple's. Both work; commands may print slightly different output. Point the IDE at the same file as
which gitto keep everything identical. - Restarting the IDE but not the terminal inside it. After changing the path, open a new integrated terminal too.
Try it yourself
Goal: prove your IDE and terminal use the same Git and identity.
- In the terminal:
which gitandgit --version. - In VS Code's or IntelliJ's integrated terminal: the same two commands.
- In the IDE, make an empty commit from the terminal:
git commit --allow-empty -m "chore: IDE check"and look at the author ingit log -1.
Expected result: identical paths and versions in both terminals; the commit's author is your configured name and email.
Show solution
Different paths mean the IDE's terminal has a different environment (common on macOS with Homebrew). It is harmless if both versions are ≥ 2.23; to unify, set git.path (VS Code) or the executable path (IntelliJ) to the terminal's path.