如何在 Mac OS 11 (M1) 上的 RStudio 中更改 Git 版本

问题描述 投票:0回答:1

我的计算机上安装了两个版本的 Git(在 M1 芯片上运行 Mac OS 11)。

git version 2.37.0 (Apple Git-136)
已预先安装。不幸的是,我发现该版本会导致一些问题,并决定切换到常规版本。我使用 Home Brew 从常规 Mac OS 终端安装
git version 2.42.0
,并使用
export PATH=/usr/local/bin:$PATH
更改为使用这个新的 Git 版本。

为了测试安装,我在Mac OS终端、VSCode的集成终端和RStudio的集成终端中运行了

git --version
which git

使用 Mac OS 终端以及 VSCode 的终端,我得到

git version 2.42.0
/opt/homebrew/bin/git

但是,使用 RStudio 的终端,我仍然得到

git version 2.37.0 (Apple Git-136)
/usr/bin/git

我尝试将全局选项中的 Git 可执行文件设置为

/opt/homebrew/bin/git
,以便更改为 VSCode 和我的 Mac 终端使用的相同版本。然而,当我这样做时,它拒绝接受并更改为
/opt/homebrew/Cellar/git/2.42.0/bin/git
。检查版本仍然会导致
git version 2.37.0 (Apple Git-136)

如何更改 RStudio 中的常规 Git 版本?

git macos installation rstudio homebrew
1个回答
0
投票

您找到解决方案了吗?我也有同样的问题。

我尝试了这篇文章中的所有方法,但它们不适用于带有 M2 芯片的 MAC。 https://apple.stackexchange.com/questions/93002/how-to-use-the-homebrew-installed-git-on-mac

brew doctor
不会产生任何结果,
brew link --overwrite git
只是给出“已经链接:/opt/homebrew/Cellar/git/2.42.0 要重新链接,请运行: 酿造取消链接git&&酿造链接git” 重新链接不会改变任何东西

© www.soinside.com 2019 - 2024. All rights reserved.