Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用/usr/local/bin/git“错误=2,Android Studio中没有此类文件或目录_Android_Git_Github_Android Studio_Github For Mac - Fatal编程技术网

&引用/usr/local/bin/git“错误=2,Android Studio中没有此类文件或目录

&引用/usr/local/bin/git“错误=2,Android Studio中没有此类文件或目录,android,git,github,android-studio,github-for-mac,Android,Git,Github,Android Studio,Github For Mac,因此,我打开了Mac的GitHub应用程序,并收到以下提示: GitHub for Mac no longer installs Git OS X 10.9 and later includes Git, so GitHub for Mac will no longer install Git as part of its command line tools. The version of Git you have installed through GitHub for Mac is n

因此,我打开了Mac的GitHub应用程序,并收到以下提示:

GitHub for Mac no longer installs Git

OS X 10.9 and later includes Git, so GitHub for Mac will no longer install Git as part of its command line tools.

The version of Git you have installed through GitHub for Mac is no longer supported. It's recommended that you uninstall it as soon as possible.

[ Uninstall Git Later] [ Uninstall Git Now ]
我继续卸载Git,因为我觉得我应该()

现在我通过Github分享我的Android Studio项目。每当我尝试将更改推送到我的项目或执行任何操作时,都会收到以下错误消息:

Can't start Git: /usr/local/bin/git Probably the path to Git executable is not valid. Fix it.
这条信息是:

Error running git “Cannot run program ”git": error=2 No such file or directory
我已经做了研究,但无法修复

我在终端中输入了一个git,我得到:

/usr/local/bin/git

设置的是Android Studio项目与Github的同步


如何解决此错误?为什么会发生这种情况?

发生这种情况的原因是:

您已经卸载了Android Studio指向的Git,它是由
Github for Mac
安装的,位于
/usr/local/bin/Git
中。但是现在你已经删除了它,所以安卓工作室当然找不到了。让我们称之为GitHub Git

但是,正如Mac的Github所提到的,这是正确的

OSX10.9及更高版本包含Git,因此用于Mac的GitHub将不再适用 安装Git作为其命令行工具的一部分

这意味着在您的系统中为OSX10.9及更高版本预先安装了另一个Git,我们称之为system Git。您可以打开
终端
,输入
git
命令来证明这一点,如下所示:

所以Git还在工作!!即使在卸载GitHub Git之后。为什么?因为
终端
正在使用系统Git。好的,你的Mac上还有git,你所要做的就是告诉Android Studio git在哪里

解决方案

  • 查找系统Git的位置。在终端中,键入
    其中是git
    。在我的例子中,我的系统Git的位置是
    /usr/bin/Git
  • 在Android Studio中,转到
    首选项
    并搜索关键字
    git
    这里您看到git
    /usr/local/bin/git
    的路径错误,应该是
    /usr/bin/git
    。只需将其替换为正确的,然后按Apply

  • 现在,一切都应该正常了。

    我当时正在使用webstorm,而这正发生在我身上。。运行上面的命令,并更新了文件路径并已工作..我希望这能工作,但由于某些原因,路径设置正确,但我得到了错误。同样的问题