将 Git 更新到最新版本 (mac)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4821181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 09:56:46  来源:igfitidea点击:

Update Git to Latest Version (mac)

gitmacos

提问by Chad

I'm running Git version 1.6.5.1. The binary is sitting in /usr/local/git/bin. Is there an easy way to update to the latest version?

我正在运行 Git 版本 1.6.5.1。二进制文件位于 /usr/local/git/bin 中。有没有简单的方法更新到最新版本?

回答by Chad

I ended up just installing homebrew.

我最终只安装了自制软件。

回答by Will Nielsen

From the Git README file:

从 Git README 文件中:

UPGRADING

Simply download the latest Git installer, run the provided uninstall.sh script, and then install as normal.

升级

只需下载最新的 Git 安装程序,运行提供的 uninstall.sh 脚本,然后正常安装即可。

Download and install from Git's website

从 Git 的网站下载并安装

回答by Kiddo

the simplest way I found so far is from git official website.

到目前为止我发现的最简单的方法是从 git 官方网站。

http://git-scm.com/book/en/Getting-Started-Installing-Git

http://git-scm.com/book/en/Getting-Started-Installing-Git

The other major way is to install Git via MacPorts (http://www.macports.org). If you have MacPorts installed, install Git via

$ sudo port install git-core +svn +doc +bash_completion +gitweb

另一种主要方法是通过 MacPorts ( http://www.macports.org)安装 Git 。如果您安装了 MacPorts,请通过以下方式安装 Git

$ sudo 端口安装 git-core +svn +doc +bash_completion +gitweb

回答by Cesar A. Rivas

Check Dan Benjaminblog. Just change git-1.6.4.2for the latest version.

检查丹本杰明博客。只需更改git-1.6.4.2为最新版本。

回答by 2540625

I found the easiest option to be to download directly from Git's website:

我发现最简单的选择是直接从 Git 的网站下载:

http://git-scm.com/downloads

http://git-scm.com/downloads

From there, I ran their installation package, quit and relaunched Terminal, and checked:

从那里,我运行他们的安装包,退出并重新启动终端,并检查:

git --version

git --version

Updated!

更新!

For what it's worth, my which gitreads:

对于它的价值,我which git读到:

/usr/local/git/bin/git

/usr/local/git/bin/git

And I have in my .bash_profile:

我在我的.bash_profile

export PATH=/usr/local/git/bin:$PATH

export PATH=/usr/local/git/bin:$PATH