无法初始化Git;AggregateError(2) 错误:无法找到 git 错误:无法找到 git

Pav*_*n N 15 git git-extensions visual-studio-code

无论我尝试重新安装多少次,我都会在我的 Visual Studio 代码中得到这个

Kim*_*ari 30

假期后,我在 macOS 上使用 VSCode 1.72.2 时遇到了这个问题。后来发现Xcode已经更新了。它要求我在使用 git 之前同意新的许可协议。

启动 Xcode,接受协议并重新加载 VSCode 解决了我的问题。


编辑:我刚才注意到@r0n9已经指出了这一点


cat*_*ith 9

就我而言,xcode-select它已经在我的终端上可用。

但我必须运行以下命令,然后错误就解决了:

xcode-select --install
Run Code Online (Sandbox Code Playgroud)


Las*_*ake 5

我曾经在安装较新的升级版 Ventura 13.0 后在我的 MAC 中遇到此错误。

正如 @r0n9 和 @Kim Ferrari 在之前的评论中提到的,在接受 XCode 许可证后问题得到了解决。

以下是我用来接受许可证和协议的命令。

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
Run Code Online (Sandbox Code Playgroud)


小智 3

你安装了git客户端吗?

https://git-scm.com/downloads

  • 虽然此链接可以回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会变得无效。- [来自评论](/review/late-answers/31763573) (3认同)