如何在macOS上将Git升级到最新版本? [英] How to upgrade Git to latest version on macOS?
问题描述
我刚刚购买了带有OS X Lion的新Mac,并在终端中检查了默认情况下安装的git版本.我得到了答案
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 version 1.7.5.4
我想将git升级到最新版本1.7.8.3,所以我下载了dmg安装程序"git-1.7.8.3-intel-universal-snow-leopard.dmg",并启动了它.
I would like to upgrade git to the latest version 1.7.8.3, so I downloaded the dmg installer "git-1.7.8.3-intel-universal-snow-leopard.dmg" and I launched it.
安装后,终端仍然会说版本是1.7.5.4.我在做什么错了?
After the install, the Terminal still says that the version is 1.7.5.4. What am I doing wrong?
推荐答案
如果添加以下内容可能会更好:
It would probably be better if you added:
export PATH=/usr/local/git/bin:/usr/local/sbin:$PATH
到主文件夹中名为.bashrc的文件.这样,也会首先找到您可能在/usr/local/git/bin
中安装的任何其他软件.
to a file named .bashrc in your home folder. This way any other software that you might install in /usr/local/git/bin
will also be found first.
要执行此操作,请输入:
For an easy way to do this just type:
echo "export PATH=/usr/local/git/bin:/usr/local/sbin:$PATH" >> ~/.bashrc
进入终端,它将为您完成
into the Terminal and it will do it for you.
这篇关于如何在macOS上将Git升级到最新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!