Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use git from terminal

Tags:

git

github

macos

I installed the GitHub UI for OS X from here: https://central.github.com/mac/latest. As part of the installation I get an option to "Install Command Line Tools". On doing so it places the relevant assets under /usr/local/bin. I assumed it would register git in the PATH variable as well so that I could run it from the terminal if needed. However it doesn't work from the terminal, instead if I run 'git' in terminal, I get prompted to install XCode.

Am I assuming something incorrectly here? Also tried installing git from here: http://git-scm.com/download/mac. After the installer completed successfully, I still can't seem to be able to use git from the terminal.

UPDATE: my PATH variable has the following:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

like image 769
Cranialsurge Avatar asked Nov 10 '13 07:11

Cranialsurge


2 Answers

As mentioned in "git on Mac: replace Apple XCode CLI git with symbolic link to latest git install?", it dpeends on the order of the folders in the PATH environment variable.

  • XCode CLI installer puts a copy of git in /usr/bin
  • Reinstalling the latest git from git-scm.com put git in /usr/local/git/bin/git

If git command line is installed in /usr/local/git/bin, make sure to put that in first:

PATH=/usr/local/git/bin:$PATH
like image 105
VonC Avatar answered Nov 11 '22 17:11

VonC


Just download these tools running command in terminal:

xcode-select --install

If it doesn't help you try to download them manually form apple developer site: https://developer.apple.com/downloads/index.action?=command%20line%20tools#

It helped me.

like image 33
averem Avatar answered Nov 11 '22 16:11

averem