git 更改 Android Studio/IntelliJ 的 xcrun 开发者路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31579670/
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 11:13:28  来源:igfitidea点击:

change xcrun developer path for Android Studio/IntelliJ

gitandroid-studiointellij-ideaosx-elcapitanxcrun

提问by x10sion

I'm using GITand am trying to push my code and getting the following error when using the Terminal. I don't use XCode, I'm using Android Studio.

我正在使用GIT并尝试推送我的代码并在使用Terminal时收到以下错误。我不使用XCode,我使用Android Studio

The command I tried using was:

我尝试使用的命令是:

git branch Networking

git branch 网络

Error:

错误:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun`

xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools),缺少 xcrun:/Library/Developer/CommandLineTools/usr/bin/xcrun`

I am running on El Capitan Beta 4update if that helps in any way.

如果有任何帮助,我正在运行El Capitan Beta 4更新。



Update: This also happens for IntelliJusers, and for MacOS Catalinaupdate

更新:这也适用于IntelliJ用户和MacOS Catalina更新

回答by Rob

I ran into the same problem, however with svn. I found that by installing El Capitan, Xcode was "uninstalled". I reinstalled Xcode from the App Store and then reinstalled Xcode Command Line Tools via Terminal with

我遇到了同样的问题,但是svn. 我发现通过安装 El Capitan,Xcode 被“卸载”了。我从 App Store 重新安装了 Xcode,然后通过终端重新安装了 Xcode 命令行工具

xcode-select --install

After installation, my /Library/Developer/CommandLineTools/usr/bindirectory reappeared and svnstarted working again.

安装后,我的/Library/Developer/CommandLineTools/usr/bin目录重新出现并重新svn开始工作。

回答by Abhishek Nandi

Instead of installing xcode you can install git from hereand change the path in android studio to /usr/local/git/bin/gitas shown in the image below.

您可以从这里安装 git,而不是安装 xcode,并将 android studio 中的路径更改/usr/local/git/bin/git为如下图所示。

studio preferences

工作室偏好

This way you save time and memory.

这样可以节省时间和内存。

回答by Jasur Shukurov

Use /usr/local/git/bin/gitas a path

使用/usr/local/git/bin/git作为路径

回答by Phileo99

In my case, Git did not work after upgrading Mac OS X High Sierra.

就我而言,升级 Mac OS X High Sierra 后,Git 不起作用。

Fortunately, the answer provided by @Rob still works for High Sierra, so there was no need for me to actually change the xcrun developer path and no need to install all of XCode

幸运的是,@Rob 提供的答案仍然适用于 High Sierra,所以我不需要实际更改 xcrun 开发人员路径,也不需要安装所有的 XCode

回答by FloT

I lost Git after upgrading to macOS Mojave.

升级到 macOS Mojave 后,我丢失了 Git。

The solution of re-installing XCode CLI still works fine.

重新安装 XCode CLI 的解决方案仍然可以正常工作。

In Terminal, type:

在终端中,输入:

xcode-select --install

... and click "Install" on the prompt.

...并在提示中单击“安装”。