简体   繁体   English

在android studio终端中无法识别git命令

[英]git command not recognisable in android studio terminal

I have just downloaded android studio as well as git.exe also.我也刚刚下载了 android studio 和git.exe I have updated path in version control-->>git also with appropriate git.exe path and tested and it is successful.我已经更新了版本控制中的路径-->>git 也使用了适当的git.exe路径并进行了测试,它成功了。 Now from terminal when I type git clone http://my projectlink, it says "'git' is not recognized as an internal or external command, operable program or batch file."现在从终端输入 git clone http://my projectlink 时,它说“'git' 不是内部或外部命令,也不是可运行的程序或批处理文件。”

Am I missing anything else?我还缺什么吗?

I found the simple solution here.我在这里找到了简单的解决方案。

Go to File--> Settings-->Terminal-->Shell Path --> Browse--> path of git bash.exe-->Apply-->OK转到文件-->设置-->终端-->外壳路径-->浏览--> git bash.exe的路径-->应用-->确定

在此处输入图片说明

Now Restart the Android studio to effect changes.现在重新启动 Android Studio 以实现更改。

OR

You could also just start a new session你也可以开始一个新的会话

That's it.就是这样。 Now you can use terminal as git bash..现在您可以将终端用作 git bash ..

You need to set Environment Variable path for your git.exe.您需要为 git.exe 设置环境变量路径。

Right-Click on My Computer Click Advanced System Settings Click Environment Variables右键单击我的电脑单击高级系统设置单击环境变量

Then under System Variables look for the path variable and click edit Add the path of git's bin to the end of the string.然后在 System Variables 下查找 path 变量并单击 edit 将 git's bin 的路径添加到字符串的末尾。

  1. Add path of installation directory of Git in environmental variables.在环境变量中添加Git的安装目录路径。 In my case I have added "C:\\Program Files\\Git\\bin" this and my problem is solved.在我的情况下,我添加了“C:\\Program Files\\Git\\bin”,我的问题就解决了。
  2. Check the box of adding environmental variable during the installation of git.勾选安装git时添加环境变量的框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM