Android 运行 git 时出错“无法运行程序“git”:错误=2

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

Error running git"Cannot run program "git": error=2

androidgithubprojectclone

提问by David91

http://www.subirimagenes.net/i/131230100130372529.png

http://www.subirimagenes.net/i/131230100130372529.png

I have this error on my Android Studio running with Mac OS 10.8.3, I've installed the github client but is not necesary...

我在运行 Mac OS 10.8.3 的 Android Studio 上出现此错误,我已经安装了 github 客户端但不是必需的...

Any help?

有什么帮助吗?

Thanks

谢谢

回答by VonC

Check the path registered in Settings -> Version Control -> Git, in text box next to "Path to Git Executable".

Settings -> Version Control -> GitPath to Git Executable”旁边的文本框中检查 中注册的路径。

It should reference a local installation of git.
If the path mentioned there doesn't exist, that would explain the error message.

它应该引用本地安装的 git。
如果那里提到的路径不存在,那将解释错误消息。

回答by Prasanna

Use your terminal and check the following.

使用您的终端并检查以下内容。

1) Check if you have installed git

1) 检查你是否安装了 git

git --version

You should see something like

你应该看到类似的东西

git version 1.7.9.5

If not, there could be an error in Git installation

如果不是,则可能是 Git 安装出错

2) See if a .gitfile exists in the directory you want to push to the remote repo.

2)查看.git要推送到远程仓库的目录中是否存在文件。

cd <into your directory>
ls -altr

You should see a file with the name .git.

您应该会看到一个名为.git.

This is the file that git will use to track the repo details.

这是 git 将用于跟踪 repo 详细信息的文件。

回答by Tr0yJ

Within terminal you can find your git install directory with:

在终端中,您可以使用以下命令找到 git 安装目录:

git --exec-path