简体   繁体   中英

How do I update git on OSX

I downloaded the latest version of Git (v1.9.x as of this post) from Github and installed it on my macbook. However after installation, when I went to the terminal and invoked 'git' I was prompted to install OS X's dev tools (XCode command line tools). So I went ahead and did this. Now when I type 'git' at the terminal and press enter, I am able to see the list of available commands and use it, however the version that is installed is v1.8.5.2.

My PATH variable is as follows:

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

Did I do something wrong here? Why is my installed version of git older than the latest one I downloaded and installed from GitHub? Did the XCode command line tools overwrite it?

The default git install is in /usr/bin , so this is the one the system finds first when you invoke it. You'll have to move /usr/local/git/bin to before /usr/bin in your $PATH for it to take precedence.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM