Git Course 0%

Check that VS Code and IntelliJ see Git

Beginner Git CLI VS Code UI IntelliJ UI ≈ 5 min

What you will learn

  • Where each IDE looks for Git and how to point it at the right executable
  • How to confirm the IDE uses your global configuration

After this lesson you can

  • Source Control works in VS Code and the Git settings test passes in IntelliJ
  • Both IDEs commit with the same identity as my terminal

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/git or /opt/homebrew/bin/git
  • Windows: C:\Program Files\Git\cmd\git.exe (this is the one to give to IDEs, not bin\git.exe)
  • Linux: /usr/bin/git

Check each tool

Terminal
$ which git
/usr/bin/git
Terminal
$ git config --global user.name
Ana Lopez

Both IDEs should report the same executable and the same identity.

Common mistakes

  • Pointing IntelliJ at the Git folder instead of the executable. The field wants the file (git.exe or git), not the folder that contains it.
  • Editing git.path with 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 git to 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.

  1. In the terminal: which git and git --version.
  2. In VS Code's or IntelliJ's integrated terminal: the same two commands.
  3. In the IDE, make an empty commit from the terminal: git commit --allow-empty -m "chore: IDE check" and look at the author in git 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.

Check yourself

1. VS Code shows "Git not found" but git --version works in Terminal.app. Best fix?
2. On Windows, which file should IntelliJ's "Path to Git executable" point at?

Key terms

IDE