Android Studio无法启动git,虽然实际上可以

时间:2021-11-22 00:20:20

My Android Studio is complaining about

我的Android Studio正在抱怨

Can't start Git: /usr/bin/git

无法启动Git:/ usr / bin / git

Probably the path to Git executable is not valid

可能Git可执行文件的路径无效

although I can actually use git in android studio, and /usr/bin/git works in terminal.

虽然我实际上可以在android studio中使用git,而/ usr / bin / git在终端中工作。

How do I get rid of this false error

我如何摆脱这个错误的错误

Here is my ~/.bash_profile

这是我的〜/ .bash_profile

export PATH=/usr/bin/git:$PATH

7 个解决方案

#1


It is probably a permission issue on AS side. You could try to symlink /usr/bin/git to /user/local/bin/git and make AS pointing to the symlink.

这可能是AS方面的许可问题。您可以尝试将/ usr / bin / git符号链接到/ user / local / bin / git,并使AS指向符号链接。

#2


If you're on Mac OSX, run sudo xcodebuild -license in the Terminal. It will show a wall of text. Carefully read the license ;) and keep pressing Space until you reach the end and then simply type agree and hit enter. This fixed the above error for me on Android Studio.

如果您使用的是Mac OSX,请在终端中运行sudo xcodebuild -license。它将显示一面文字。仔细阅读许可证;)并按住空格直到你到达终点然后只需键入agree并按Enter键。这在Android Studio上为我修复了上述错误。

On some occasions even that might not fix this issue. Try running the following command in the Terminal and restart Android Studio.

在某些情况下甚至可能无法解决这个问题。尝试在终端中运行以下命令并重新启动Android Studio。

sudo /usr/bin/git

#3


Fixed it.. There was no Xcode installed on my mac.

修复它..我的mac上没有安装Xcode。

Installed it from command line

从命令行安装它

xcode-select --install

It will ask for prompt to install accept and install

它会要求提示安装接受和安装

Then try

git --version

#4


After update Xcode to 7.0 my Android Studio complained about Git and the solution for me was go to terminal and type

在将Xcode更新到7.0后,我的Android Studio抱怨Git,我的解决方案是转到终端并输入

 sudo /usr/bin/git

or

sudo git --version

This will show you this message:

这将显示此消息:

You have not agreed to the Xcode license agreements.You must agree to both license agreements below in order to use Xcode.

您尚未同意Xcode许可协议。您必须同意以下两个许可协议才能使用Xcode。

at the final you have to agree the license

在决赛中你必须同意许可证

By typing 'agree' you are agreeing to the terms of the software license agreements.

输入“同意”即表示您同意软件许可协议的条款。

#5


In order to find the git path:

为了找到git路径:

which git

#6


First you need to accept the license

首先,您需要接受许可证

xcodebuild -license accept

#7


In my case i downloaded an update of Xcode and didn't remember to Accept the New License Agreement/Terms and Conditions. So i just started the Xcode and Agreed to New License Agreement and it started working.

在我的情况下,我下载了Xcode的更新,并且不记得接受新的许可协议/条款和条件。所以我刚刚启动Xcode并同意新的许可协议,它开始工作。

#1


It is probably a permission issue on AS side. You could try to symlink /usr/bin/git to /user/local/bin/git and make AS pointing to the symlink.

这可能是AS方面的许可问题。您可以尝试将/ usr / bin / git符号链接到/ user / local / bin / git,并使AS指向符号链接。

#2


If you're on Mac OSX, run sudo xcodebuild -license in the Terminal. It will show a wall of text. Carefully read the license ;) and keep pressing Space until you reach the end and then simply type agree and hit enter. This fixed the above error for me on Android Studio.

如果您使用的是Mac OSX,请在终端中运行sudo xcodebuild -license。它将显示一面文字。仔细阅读许可证;)并按住空格直到你到达终点然后只需键入agree并按Enter键。这在Android Studio上为我修复了上述错误。

On some occasions even that might not fix this issue. Try running the following command in the Terminal and restart Android Studio.

在某些情况下甚至可能无法解决这个问题。尝试在终端中运行以下命令并重新启动Android Studio。

sudo /usr/bin/git

#3


Fixed it.. There was no Xcode installed on my mac.

修复它..我的mac上没有安装Xcode。

Installed it from command line

从命令行安装它

xcode-select --install

It will ask for prompt to install accept and install

它会要求提示安装接受和安装

Then try

git --version

#4


After update Xcode to 7.0 my Android Studio complained about Git and the solution for me was go to terminal and type

在将Xcode更新到7.0后,我的Android Studio抱怨Git,我的解决方案是转到终端并输入

 sudo /usr/bin/git

or

sudo git --version

This will show you this message:

这将显示此消息:

You have not agreed to the Xcode license agreements.You must agree to both license agreements below in order to use Xcode.

您尚未同意Xcode许可协议。您必须同意以下两个许可协议才能使用Xcode。

at the final you have to agree the license

在决赛中你必须同意许可证

By typing 'agree' you are agreeing to the terms of the software license agreements.

输入“同意”即表示您同意软件许可协议的条款。

#5


In order to find the git path:

为了找到git路径:

which git

#6


First you need to accept the license

首先,您需要接受许可证

xcodebuild -license accept

#7


In my case i downloaded an update of Xcode and didn't remember to Accept the New License Agreement/Terms and Conditions. So i just started the Xcode and Agreed to New License Agreement and it started working.

在我的情况下,我下载了Xcode的更新,并且不记得接受新的许可协议/条款和条件。所以我刚刚启动Xcode并同意新的许可协议,它开始工作。