使用 VScode 在 Mac 上更新 Git 时出现问题

Jah*_*mad 3 git macos powershell homebrew visual-studio-code

所以基本上我正在尝试在我的 Mac 上更新 git,我使用 VScode 并将其中一个终端支持为 powershell,所以我使用以下命令检查它的版本

git --version
Run Code Online (Sandbox Code Playgroud)

我从中得到的是

git version 2.15.0
Run Code Online (Sandbox Code Playgroud)

所以我假设我没有更新它所以我继续并使用了命令

brew upgrade git
Run Code Online (Sandbox Code Playgroud)

我收到回复说"Warning: git 2.34.1 already installed",我再次检查了一下,git 版本仍然是 2.15.0

关于如何解决这个问题有什么想法吗?

Jah*_*mad 5

嘿伙计们,感谢所有评论该做什么以及发生了什么的人,所以最终在玩了一段时间后,这就是我能够做的!

所以我进入我的终端并运行brew install git

之后我在终端中收到如下回复

Linking /usr/local/Cellar/git/2.34.1... 
Error: Could not symlink bin/git
Target /usr/local/bin/git
already exists. You may want to remove it:
  rm '/usr/local/bin/git'

To force the link and overwrite all conflicting files:
  brew link --overwrite git

To list all files that would be deleted:
  brew link --overwrite --dry-run git 
Run Code Online (Sandbox Code Playgroud)

所以我去运行命令

brew link --overwrite git
Run Code Online (Sandbox Code Playgroud)

我得到的答复是:

Linking /usr/local/Cellar/git/2.34.1... 213 symlinks created.
Run Code Online (Sandbox Code Playgroud)

之后运行以下命令

brew link --overwrite --dry-run git
Run Code Online (Sandbox Code Playgroud)

得到以下回复:

警告:已经链接:/usr/local/Cellar/git/2.34.1

要重新链接,请运行:
brew unlink git &&brew link git

所以我最后检查了一下 git 版本是什么

git --version
Run Code Online (Sandbox Code Playgroud)

我得到了更新的 git 版本,我试图让我的路径对齐!

git version 2.34.1
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助任何需要这方面帮助的人!我没有删除“/usr/local/bin/git”,但希望我以后不需要或不必担心它。