警告:您的 git 版本是 1.9.3.存在严重的安全漏洞



我在部署到 Heroku 期间收到有关 git 1.9.3 严重安全漏洞的警告

我尝试通过自制软件更新 git,但发现 git 最初不是通过自制软件安装

然后我通过自制软件安装了它

brew update
brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.2.1.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.2.1.mavericks.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The "contrib" directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/git/2.2.1: 1356 files, 31M

之后,当我检查git版本时,它保持不变

⇒  git --version   
git version 1.9.3 (Apple Git-50)    

在我看来,自制软件在文件夹/usr/local/Cellar/git/2.2.1 中安装了 git

最后我的问题:我应该怎么做才能开始使用自制的 git 而不是原来的 git

⇒  which git
/usr/bin/git
⇒  git --version
git version 1.9.3 (Apple Git-50)
您需要在/

usr/bin/git 处重命名原始 git,例如

sudo mv /usr/bin/git /usr/bin/git-original

现在再次检查位置和版本

⇒  which git
/usr/local/bin/git
⇒  git --version
git version 2.2.1

添加符号链接以实现向后兼容性(以防 IDE 使用 git 的直接位置)

sudo ln -s /usr/local/bin/git /usr/bin/git

就像Jubobs评论的那样,您可以简单地将其添加到您的路径中,如下所示:

echo 'export PATH="/usr/local/git/bin:$PATH"'>> ~/.bash_profile

只需将 ~/.bash_profile 更改为您正在使用的任何 bash 配置文件即可。

最新更新