错误:无法找到实用程序“git”,而不是开发人员工具或在 PATH 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37648886/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:02:33  来源:igfitidea点击:

error: unable to find utility "git", not a developer tool or in PATH

gitxcode7.3

提问by wenyc

I have updated Xcode version to 7.3.1.when I use 'git status',I find an error! as follow:

我已将 Xcode 版本更新为 7.3.1。当我使用“ git status”时,发现错误!如下:

$git status
sh: line 1:  1601 Segmentation fault: 11  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find git 2> /dev/null
git: error: unable to find utility "git", not a developer tool or in PATH

Thank you advanced!

谢谢先进!

采纳答案by yorammi

The best solution will be to download and install it - even that you assume it is already installed: https://git-scm.com/download/mac

最好的解决方案是下载并安装它 - 即使您假设它已经安装:https: //git-scm.com/download/mac

回答by Gedas Kutka

This happened to me also with upgrading to High Sierra and XCode to 9. This sequence has fixed it.

这也发生在我身上,升级到 High Sierra 和 XCode 到 9。这个序列已经修复了它。

xcode-select --install
sudo xcode-select -s /Library/Developer/CommandLineTools

Found this answer on https://davidwalsh.name/fix-git-high-sierra-upgrade(article and comments.)

https://davidwalsh.name/fix-git-high-sierra-upgrade(文章和评论)上找到了这个答案。

回答by RhinoDavid

I had this same problem -- I exited my bash session (closed the terminal) and started a new one and it fixed it.

我遇到了同样的问题——我退出了我的 bash 会话(关闭了终端)并启动了一个新的会话并修复了它。

回答by Nick Grealy

For me, I had to uninstall and reinstall all my brewapplications, as documented here.

对我来说,我必须卸载并重新安装所有brew应用程序,如此处所述

i.e.

IE

brew list -1 > brew.txt # list out all installed packages
brew list -1 | xargs brew rm --force # remove all installed packages
brew install $(cat brew.txt | tr '\n' ' ') # install all previously installed packages

回答by Jose

None of the above solutions fixed the issue for me, I had to actually just restart my computer which fixed it. This was a weird bug.

上述解决方案都没有为我解决这个问题,我实际上只需要重新启动我的计算机就可以解决它。这是一个奇怪的错误。