use*_*063 4 git terminal homebrew
尝试用 homebrew 更新我的 git,我遇到了这个问题:
MBP:GitHub_Tutorial nasdas$ brew install git
Warning: git 2.21.0 is already installed and up-to-date
To reinstall 2.21.0, run `brew reinstall git`
MBP:GitHub_Tutorial nasdas$ git --version
git version 2.17.2 (Apple Git-113)
Run Code Online (Sandbox Code Playgroud)
大概您已经安装了两个版本,彼此独立。
\n\n使用type git或which git查看您正在运行哪一个。大概是/usr/bin/git吧 酿造安装的可能是/usr/local/bin/git. 更改您的$PATH(或$path您的 shell 使用的任何内容)放在/usr/local/bin前面/usr/bin,以便git运行新的而不是旧的,或用于/usr/local/bin/git运行新的。
(并且,正如Greg Bacon 在评论中指出的那样,请注意,您可能必须hash -r在各种 shell 中运行,以便让他们在安装某些内容后再次检查/usr/local/bin,如果他们已经决定这git意味着/usr/bin/git即使之前$PATH已经这样做了/usr/local/bin。在 csh/tcsh 中这是rehash代替hash -r。)
(事实证明,这是哈希问题\xe2\x80\x94,您的 shell 早些时候决定,这git意味着旧的问题。再次登录也可以清除此类问题,但这很痛苦!)