89

What is the terminal command to find the version of Git currently installed on my system?

zechdc
  • 1,287
  • 2
  • 14
  • 18

1 Answers1

109

Yeah, simple - git --version (holds true for most applications)


If you get -bash: git: command not found when you run git --version it means git is not installed or it is not on PATH.

  1. Make sure git is installed.

    • Git is usually installed at /usr/local/git/
    • Make sure there is a binary file where you installed git. If not, install git.
  2. If git is installed, then it is mostly likely not on PATH

    • Find the path where you installed it and do something like this to add it to the path and set in your profile:

      echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile

    • Then make sure you restart terminal before trying to run any git commands

N.N.
  • 1,381
  • 2
  • 17
  • 34
manojlds
  • 2,158
  • 1
  • 16
  • 11
  • Ok, thats what I thought. When I try that I get "-bash: git: command not found" I know git is installed. Been using it for some time now. I am in my users directory if that matters. – zechdc Oct 18 '11 at 03:38
  • @zechdc - If you get command not found, either it is not installed, or it is not on PATH. – manojlds Oct 18 '11 at 03:44
  • @Radu It is installed. At least I believe it is installed. I just committed something using Tower App. – zechdc Oct 18 '11 at 03:44
  • @zechdc - Find where you installed and do something like `echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile` – manojlds Oct 18 '11 at 03:48
  • @manojlds Ok, it looks like git is installed at `/usr/local/git`. I ran that command and it created a file called .profile in my user directory. Still can't run `git --version` Is there more to it than just run that command? I am kinda a terminal newb. :) – zechdc Oct 18 '11 at 04:02
  • @zechdc - Make sure that folder - `/usr/local/git` does have a `git` binary file. – manojlds Oct 18 '11 at 04:05
  • @manojlds There is a "Unix Executable File" called "git" located at /usr/local/git/bin/ – zechdc Oct 18 '11 at 04:09
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/4346/discussion-between-zechdc-and-manojlds) – zechdc Oct 18 '11 at 04:09