When I start Android Studio there's a message
当我启动Android Studio时,有一个消息。
Can't start Git: C:\Program Files (x86)\Git\cmd\git.cmd Probably the path to Git executable is not valid. Fix it.
不能开始Git:C:\Program Files (x86)\Git\cmd\git.cmd可能通往Git可执行文件的路径无效。解决它。
But I can see that the git.cmd IS there. How do I fix the issue then?
但是我可以看到git。cmd是存在的。那么我该如何解决这个问题呢?
16 个解决方案
#1
26
Check that C:\Program Files (x86)\Git\cmd
is in you Path environment variable:
检查C:\Program Files (x86)\Git\cmd在Path环境变量:
echo $env:Path
#2
95
For some reason this morning, I had to agree to the terms and conditions by running git as administrator in the command line.
出于某种原因,今天早上,我必须通过在命令行运行git作为管理员来同意条款和条件。
On the mac
在mac上
sudo /usr/bin/git
sudo /usr/bin/git
On the pc
在电脑上
c:\path\to\git.exe
c:\ \ \ git.exe
Accept the EULA.
接受EULA。
After I did that, I was able to use git in my IDE.
这样做之后,我就可以在IDE中使用git了。
#3
31
For the one using mac who installed Xcode7, you have to start Xcode and accept the license agreement for the android studio error to go away.
对于安装了Xcode7的mac,您必须启动Xcode并接受android studio错误的许可协议。
#4
14
I had the same problem, this is how I fixed it:
我遇到了同样的问题,我是这样解决的:
I use windows...
我使用windows……
Go to
去
C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
So in my Account I had this
在我的账户里有这个。
C:\Users\victor\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
Make sure you find the git.exe
一定要找到它。
Then go to the VCS window(Settings --> Version Control---> Git
), and paste the PATH and append git.exe
at the end
然后转到VCS窗口(设置——>版本控制——> Git),并粘贴路径和append Git。exe结束时
So you shall have this
所以你会得到这个。
C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\git.exe
Then click test to verify if git is working well.
然后单击test以验证git是否运行良好。
#5
7
In my case, with GitHub Desktop for Windows (as of June 2, 2016) & Android Studio 2.1:
在我的案例中,使用GitHub桌面Windows(截至2016年6月2日)和Android Studio 2.1:
This folder ->
这个文件夹- >
C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\
Contained a BATCH file called something like 'post-install.bat'. Run this file to create a folder 'cmd' with 'git.exe' inside.
包含一个名为“post-install.bat”的批处理文件。运行此文件以创建一个带有'git '的文件夹'cmd'。exe”内。
This path-->
这条路径- - >
C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\cmd\git.exe
would be the location of 'git.exe' after running the post-install script.
就是“git”的位置。exe运行后安装脚本。
#6
6
If you are using Mac OS
and have updated XCode
you probably need to open XCode and accept the terms to avoid this error.
如果您使用的是Mac OS,并且已经更新了XCode,那么您可能需要打开XCode并接受这些术语来避免这个错误。
#7
5
First make sure you have installed git scm or not. If not, here's the link for windows: https://git-for-windows.github.io/ Then go to Android studio and configure the link of Git to the place where you installed your git(probably in C:/program files) I referred to a YouTube video to solve my issue. You can refer it here: https://www.youtube.com/watch?v=faEd2syXypE
首先确保已经安装了git scm。如果没有,这是windows的链接:https://git-for-window。github。io/然后到Android studio,将Git的链接配置到你安装Git的地方(可能是在C:/program文件中),我提到了一个YouTube视频来解决我的问题。你可以在这里参考:https://www.youtube.com/watch?
#8
3
Use bin folder and exe instead. Path will be C:\Program Files (x86)\Git\bin\git.exe
使用bin文件夹和exe代替。路径将是c:)
Also sometimes it doesn't work if there are blank spaces in path name as in your program files directory name.
有时,如果在路径名中有空格,就像在程序文件目录名中一样,它也不起作用。
In that case, copy the whole git folder to root of partition and then link studio to it
在这种情况下,将整个git文件夹复制到分区根,然后将studio链接到它。
#9
3
I showed my hide directories in windows 7 and find git.exe in C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\
and it works but I don't know why git.exe
is there. I installed git version 1.9.5
我在windows 7中显示了我的隐藏目录,并找到了git。exe C:\Users\(用户名)\ AppData \当地\ GitHub \ PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad \ bin \和它的工作原理,但我不知道为什么git。exe。我安装了git版本1.9.5。
#10
3
Had to restart Android Studio after installing GIT for Windows.
在为Windows安装GIT之后,不得不重新启动Android Studio。
#11
2
In Android Studio, goto File->Settings->Version Control->Git. Set the 'Path to Git Executable' to point to git.exe. Verify by clicking Test.
在Android Studio中,goto文件->设置->版本控制->Git。设置“到Git可执行文件的路径”以指向Git .exe。点击测试验证。
#12
2
In Windows, my git was located at
在Windows中,我的git位于。
C:\Users\<username>\AppData\Local\Programs\Git\bin\git.exe
当地C:\Users\ <用户名> \ AppData \ \程序\ Git \ bin \ git.exe
#13
2
To fix this, I did a reinstall of xcode (This also presented user agreement). I used the following command:
为了解决这个问题,我重新安装了xcode(这也提供了用户协议)。我使用了以下命令:
xcode-select --install
#14
1
The path for your git is invalid. Copy the path from File -> Settings -> Version Control -> Git and search that folder and you can see the path to your Git is not valid. Reset the path with correct location and test it. The error should be gone.
您的git路径无效。复制文件->设置的路径->版本控制-> Git和搜索那个文件夹,你可以看到通往你的Git的路径是无效的。设置正确的路径并进行测试。错误应该消失了。
#15
1
Run sudo git --version
from command line and agree to the license and this should fix the issue.
运行sudo git——从命令行运行版本,并同意许可证,这将解决问题。
#16
0
Try this...
试试这个…
-
Make sure, have you installed git on your machine. If not you can download(Windows user) from here and install it your system. For Mac user can download from here
确保你在机器上安装了git。如果您不能从这里下载(Windows用户)并安装它您的系统。对于Mac用户可以从这里下载。
-
得到的位置git.exe
-
测试git。exe手动
-
Now you can set your git.exe location in android studio.
现在可以设置git了。在android studio的exe位置。
#1
26
Check that C:\Program Files (x86)\Git\cmd
is in you Path environment variable:
检查C:\Program Files (x86)\Git\cmd在Path环境变量:
echo $env:Path
#2
95
For some reason this morning, I had to agree to the terms and conditions by running git as administrator in the command line.
出于某种原因,今天早上,我必须通过在命令行运行git作为管理员来同意条款和条件。
On the mac
在mac上
sudo /usr/bin/git
sudo /usr/bin/git
On the pc
在电脑上
c:\path\to\git.exe
c:\ \ \ git.exe
Accept the EULA.
接受EULA。
After I did that, I was able to use git in my IDE.
这样做之后,我就可以在IDE中使用git了。
#3
31
For the one using mac who installed Xcode7, you have to start Xcode and accept the license agreement for the android studio error to go away.
对于安装了Xcode7的mac,您必须启动Xcode并接受android studio错误的许可协议。
#4
14
I had the same problem, this is how I fixed it:
我遇到了同样的问题,我是这样解决的:
I use windows...
我使用windows……
Go to
去
C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
So in my Account I had this
在我的账户里有这个。
C:\Users\victor\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin
Make sure you find the git.exe
一定要找到它。
Then go to the VCS window(Settings --> Version Control---> Git
), and paste the PATH and append git.exe
at the end
然后转到VCS窗口(设置——>版本控制——> Git),并粘贴路径和append Git。exe结束时
So you shall have this
所以你会得到这个。
C:\Users\<username>\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\git.exe
Then click test to verify if git is working well.
然后单击test以验证git是否运行良好。
#5
7
In my case, with GitHub Desktop for Windows (as of June 2, 2016) & Android Studio 2.1:
在我的案例中,使用GitHub桌面Windows(截至2016年6月2日)和Android Studio 2.1:
This folder ->
这个文件夹- >
C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\
Contained a BATCH file called something like 'post-install.bat'. Run this file to create a folder 'cmd' with 'git.exe' inside.
包含一个名为“post-install.bat”的批处理文件。运行此文件以创建一个带有'git '的文件夹'cmd'。exe”内。
This path-->
这条路径- - >
C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_<hash>\cmd\git.exe
would be the location of 'git.exe' after running the post-install script.
就是“git”的位置。exe运行后安装脚本。
#6
6
If you are using Mac OS
and have updated XCode
you probably need to open XCode and accept the terms to avoid this error.
如果您使用的是Mac OS,并且已经更新了XCode,那么您可能需要打开XCode并接受这些术语来避免这个错误。
#7
5
First make sure you have installed git scm or not. If not, here's the link for windows: https://git-for-windows.github.io/ Then go to Android studio and configure the link of Git to the place where you installed your git(probably in C:/program files) I referred to a YouTube video to solve my issue. You can refer it here: https://www.youtube.com/watch?v=faEd2syXypE
首先确保已经安装了git scm。如果没有,这是windows的链接:https://git-for-window。github。io/然后到Android studio,将Git的链接配置到你安装Git的地方(可能是在C:/program文件中),我提到了一个YouTube视频来解决我的问题。你可以在这里参考:https://www.youtube.com/watch?
#8
3
Use bin folder and exe instead. Path will be C:\Program Files (x86)\Git\bin\git.exe
使用bin文件夹和exe代替。路径将是c:)
Also sometimes it doesn't work if there are blank spaces in path name as in your program files directory name.
有时,如果在路径名中有空格,就像在程序文件目录名中一样,它也不起作用。
In that case, copy the whole git folder to root of partition and then link studio to it
在这种情况下,将整个git文件夹复制到分区根,然后将studio链接到它。
#9
3
I showed my hide directories in windows 7 and find git.exe in C:\Users\(UserName)\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin\
and it works but I don't know why git.exe
is there. I installed git version 1.9.5
我在windows 7中显示了我的隐藏目录,并找到了git。exe C:\Users\(用户名)\ AppData \当地\ GitHub \ PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad \ bin \和它的工作原理,但我不知道为什么git。exe。我安装了git版本1.9.5。
#10
3
Had to restart Android Studio after installing GIT for Windows.
在为Windows安装GIT之后,不得不重新启动Android Studio。
#11
2
In Android Studio, goto File->Settings->Version Control->Git. Set the 'Path to Git Executable' to point to git.exe. Verify by clicking Test.
在Android Studio中,goto文件->设置->版本控制->Git。设置“到Git可执行文件的路径”以指向Git .exe。点击测试验证。
#12
2
In Windows, my git was located at
在Windows中,我的git位于。
C:\Users\<username>\AppData\Local\Programs\Git\bin\git.exe
当地C:\Users\ <用户名> \ AppData \ \程序\ Git \ bin \ git.exe
#13
2
To fix this, I did a reinstall of xcode (This also presented user agreement). I used the following command:
为了解决这个问题,我重新安装了xcode(这也提供了用户协议)。我使用了以下命令:
xcode-select --install
#14
1
The path for your git is invalid. Copy the path from File -> Settings -> Version Control -> Git and search that folder and you can see the path to your Git is not valid. Reset the path with correct location and test it. The error should be gone.
您的git路径无效。复制文件->设置的路径->版本控制-> Git和搜索那个文件夹,你可以看到通往你的Git的路径是无效的。设置正确的路径并进行测试。错误应该消失了。
#15
1
Run sudo git --version
from command line and agree to the license and this should fix the issue.
运行sudo git——从命令行运行版本,并同意许可证,这将解决问题。
#16
0
Try this...
试试这个…
-
Make sure, have you installed git on your machine. If not you can download(Windows user) from here and install it your system. For Mac user can download from here
确保你在机器上安装了git。如果您不能从这里下载(Windows用户)并安装它您的系统。对于Mac用户可以从这里下载。
-
得到的位置git.exe
-
测试git。exe手动
-
Now you can set your git.exe location in android studio.
现在可以设置git了。在android studio的exe位置。