Francesco Menzani Francesco Menzani - 1 year ago 216
Git Question

git command is not recognized on Terminal tool window in IntelliJ IDEA

I am trying to use Bitbucket with IntelliJ IDEA Community Edition.

  1. I went to File >> Settings... >> Plugins and installed the Bitbucket plugin. The Git Integration plugin seems enabled already.

  2. I went to File >> Settings... >> Other Settings >> Bitbucket and logged in.

  3. I installed Git-1.9.5-preview20141217.

  4. I went to File >> Settings... >> Version Control >> Git and set Path to Git executable to C:\Program Files (x86)\Git\bin\git.exe. Testing will find it.

  5. I activated all this under VCS. I saw a successful message.

Then I created a repository on a team.
Now I must do the first commit, right?

Already have a Git repository on your computer? Let's push it up to Bitbucket.

cd /path/to/my/repo
git remote add origin
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags

I opened View >> Tool Windows >> Terminal.

"git" is not recognized as an internal or external command

Answer Source

The terminal tool window is just a terminal emulator for a command shell. In case of Windows that shell defaults to cmd, which is completely independent of the IDE settings. So in order for that to work you must have git in PATH environment variable.

You can do it this way:

  1. Go to Control panel/System/Advanced System Settings
  2. Click Environment variables
  3. Select PATH and click Edit
  4. Append following string at the end of the variable value: ;C:\Program Files (x86)\Git\bin
    • The semicolon is important, because individual PATH entries are delimited by it
    • The path to git bin directory might be different on your system

This works on Windows 8.1. It might be a little different on older versions of Window. Just in case here is a link which covers this procedure on more Windows versions.

Or you could set Git Bash as the shell for the Terminal tool window. Personally I prefer this approach on Windows computers. You can do it by going into Settings/Terminal and setting Shell path to something like "C:\Program Files (x86)\Git\bin\sh.exe" --login -i (this might be different on your computer).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download