找不到 Git 命令。请创建别名或将其添加到您的 PATH

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

Git command could not be found. Please create an alias or add it to your PATH

gitgithubgithub-for-windows

提问by Mohit Bhansali

After updating github, I am getting these WARNING.

更新github后,我得到了这些WARNING

git command could not be found. Please create an alias or add it to your PATH.

Warning: Could not find ssh-agent.

找不到 git 命令。请创建别名或将其添加到您的 PATH。

警告:找不到 ssh-agent。

When I am trying any commands, I get error messages.

当我尝试 any 时commands,我收到错误消息。

After searching, I found other people are facing similar problem. Here is the link. But they are suggesting to re-install github.

经过搜索,我发现其他人也面临着类似的问题。这是链接。但是他们建议重新安装github。

Is there any other solution expect re-installing github?

除了重新安装github之外,还有其他解决方案吗?

回答by Kirk

Short version

精简版

To fix it

要解决这个问题

  • close Git Shell
  • open GitHuband let it do some post installation.
  • Open Git Shellagain and you should be fixed.
  • 关闭Git Shell
  • 打开GitHub,让它做一些安装后的工作。
  • 再次打开Git Shell,你应该得到修复。

Long version

长版

Just to make sure I follow you, you just did this

只是为了确保我关注你,你只是这样做了

  • Open Git Shell
  • You are prompted to update GitHub
  • After the update, Git Shellopens
  • 打开Git Shell
  • 系统会提示您更新GitHub
  • 更新后,Git Shell打开

Now it gives the error

现在它给出了错误

git command could not be found. Please create an alias or add it to your PATH.

Warning: Could not find ssh-agent.

找不到 git 命令。请创建别名或将其添加到您的 PATH。

警告:找不到 ssh-agent。

If this is the case, do this

如果是这种情况,请执行此操作

  • Close Git Shell
  • Now open the GitHubapplication (not Git Shell).
  • 关闭Git Shell
  • 现在打开GitHub应用程序(不是Git Shell)。

This will say something along the lines of (not sure of the exact version)

这会说一些类似的东西(不确定确切的版本)

GitHub is extracting git..

GitHub 正在提取 git..

Let that go through the process and after it is complete, go open Git Shelland it is fixed. Just worked for me at least.

让它完成整个过程,完成后,打开Git Shell并修复它。至少对我有用。

回答by Sjark

I guess you could try to add git to your path.

我想您可以尝试将 git 添加到您的路径中。

Go to Start -> Right click My Computer -> Properties

转到开始 -> 右键单击​​我的电脑 -> 属性

Go to Advanced system settings

进入高级系统设置

Press Environment Variables...

按环境变量...

Find Path and press Edit

找到路径并按编辑

Enter ";PATH to git.exe file" at the end of the path.

在路径末尾输入“;PATH to git.exe file”。

Reboot

重启