How to upgrade Git to latest version on macOS?

前端 未结 15 1847
离开以前
离开以前 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:34

    I prefer not to alter the path hierarchy, but instead deal with git specifically...knowing that I'm never going to use old git to do what new git will now manage. This is a brute force solution.

    NOTE: I installed XCode on Yosemite (10.10.2) clean first.

    I then installed from the binary available on git-scm.com.

    $ which git
    /usr/bin/git
    $ cd /usr/bin
    $ sudo ln -sf /usr/local/git/bin/git
    $ sudo ln -sf /usr/local/git/bin/git-credential-osxkeychain
    $ sudo ln -sf /usr/local/git/bin/git-cvsserver
    $ sudo ln -sf /usr/local/git/bin/git-receive-pack
    $ sudo ln -sf /usr/local/git/bin/git-shell
    $ sudo ln -sf /usr/local/git/bin/git-upload-archive
    $ sudo ln -sf /usr/local/git/bin/git-upload-pack
    $ ls -la
    (you should see your new symlinks)
    

提交回复
热议问题