Upgrading Git on Mac OS x

Source: Internet
Author: User

Use git--version to view git versions in terminal, often not the latest version.

Download the latest git version from the GIT website http://git-scm.com/, after the installation path is:/usr/local/git/bin/git. But the result returned with the which git command is/usr/bin/git, and the version does not change. Using the Echo $PATH to view the path, the results are as follows:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/x11/bin:/usr/local/git/bin

/usr/bin is ranked before/usr/local/git/bin, so the old git version is used by default

Method One:

Refer to the article (what it was and how to Modify the Shell path in OSX 10.10 Yosemite using Terminal) method to modify the shall path

1. Create a. bash_profile file with the editor nano using the command line , i.e. enter the following command in Terminal

<span style= "Font-family:microsoft yahei;font-size:14px;" >nano .bash_profile</span>

2, add the following, enter:

Export path= "/usr/local/git/bin: $PATH"
Then press "Ctrl+o" to save, then press "return" (enter) to confirm, and then press "Ctrl+x" to exit


3, re-login terminal, with "echo $PATH" to view the path, the results are as follows:

/usr/local/git/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/x11/bin

Use new version by default



Method Two: Remove the system's own version ( refer to article: How to: Upgrade Git on mac OS x)

Cd/usr/bin
sudo mkdir backup-git-apple

sudo mv git* backup-git-apple



Upgrading Git on Mac OS x

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.