How to upgrade Git to latest version on macOS?

前端 未结 15 1821
离开以前
离开以前 2020-12-02 03:57

I just bought a new Mac with OS X Lion and I checked in the Terminal what version of git is installed by default. I got the answer

git --version
> git ver         


        
15条回答
  •  不思量自难忘°
    2020-12-02 04:52

    I recently upgraded the Git on my OS X machine to the latest also. I didn't use the same .dmg you used, but when I installed it the binaries were placed in /usr/local/bin. Now, the way my PATH was arranged, the directory /usr/bin appears before /usr/local/bin. So what I did was:

    cd /usr/bin
    mkdir git.ORIG
    mv git* git.ORIG/
    

    This moves the several original programs named git* to a new subdirectory that keeps them out of the way. After that, which git shows that the one in /usr/local/bin is found.

    Modify the above procedure as necessary to fit wherever you installed the new binaries.

提交回复
热议问题