31

I'm using IntelliJ on my MacBook and get this message every time I open the app. I already checked the Preferences > Version Control > Git under "Path to Git executable" and set this path to the path that is shown in my terminal for whereis git. Also, testing the path in the IntelliJ settings returns a "Git version is 2.30.1". What else can I do to fix this problem?

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
inconnu
  • 611
  • 1
  • 5
  • 14
  • 1
    Would it be an option for you to use Homebrew git? Could you please install it and change bath to brew Git in IDE settings? There is a chance that you have faced known issue with xcode Git: https://youtrack.jetbrains.com/issue/IDEA-248193 – Ruslan Kuleshov Sep 23 '21 at 09:09
  • @RuslanKuleshov Yes I'm using Homebrew git instead of git in IntelliJ at the moment. The path to brew git is in "whereis git" right? If so, the path in the IDE settings is already set to brew git. – inconnu Sep 23 '21 at 10:41
  • >The path to brew git is in "whereis git" right? Not necessarily, you may not have changed your PATH variable and it may store your xCode git there. path to homebrew git `/usr/local/bin/git` – Ruslan Kuleshov Sep 23 '21 at 11:06
  • @RuslanKuleshov If I set the "Path to Git executable" to `/usr/local/bin/git` and test it in the settings, it says "Git is not installed No such file" – inconnu Sep 23 '21 at 11:11

7 Answers7

65

In my case the issue was solved by invalidating cache and restarting IDE. Simply go to Files -> Invalidate Caches -> Invalidate and Restart.

Hovik Antanisyan
  • 669
  • 1
  • 4
  • 5
23

In my case, the IDE seems only be able to recognize the path of git as /usr/local/bin/git, but git is installed at /usr/bin/git. So I made a softlink between of them.

sudo ln -s /usr/bin/git /usr/local/bin/git 
buddemat
  • 4,552
  • 14
  • 29
  • 49
zphou00
  • 346
  • 1
  • 5
5

Open Preferences > Git > version control > git > Path to Git executables : set to

/usr/local/bin/git

or

/usr/bin/git

Ali Ashraf
  • 1,841
  • 2
  • 24
  • 27
1

For people using windows with wsl2, IntelliJ might automatically detect the correct file, but sometimes is not able to access. Restarting wsl and IntelliJ helped for me:

  1. Restart wsl
  • Open cmd as admin
  • run "wsl.exe --shutdown"
  • run "wsl.exe"
  1. Restart intelliJ
0

In my case, I fixed this issue by going to Preferences > Build, Execution, Deployment > Build Tools > Gradle and update Gradle JDK from 1.8 to 11

Rick Royd Aban
  • 904
  • 6
  • 33
0

Just update/install git with following command:

brew install git

Go to Intellij IDEA (Top left corner) -> Preference -> Version control -> Git -> Enter "/usr/local/bin/git" (generally git is installed in this path to verify it once, you can enter the same in finder) for "Path to git executable"

Boom!! Your Git is back.

Cheers!! :)

Priyanka B
  • 101
  • 9
0

All of the methods above are not working for me.

First of all, I Invalidate Caches -> Invalidate and Restart. Secondly, I have to run the git command manually. Then it seems trigger something internally to find git path, I guess. Afterwards it is working.

Bigeyes
  • 1,508
  • 2
  • 23
  • 42