windows 如何安装 Git Shell

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

How to install Git Shell

windowsgitshell

提问by BaltoStar

Windows 7 Ultimate

Windows 7旗舰版

I used to have Git Shell installed. The icon is grey with a cat face. It was either installed by the Git or by GitHub for Windows.

我曾经安装过 Git Shell。该图标为灰色,带有猫脸。它要么由 Git 安装,要么由 GitHub for Windows 安装。

Somehow I've lost it.

不知怎的,我已经失去了它。

I've tried re-installing both Git and GitHub for Windows, but I can't get it back.

我已经尝试为 Windows 重新安装 Git 和 GitHub,但我无法将其恢复。

回答by VonC

If you have GitHub for Windows(installed, it should come with your shortcut.

如果您有Windows 版 GitHub(已安装,它应该带有您的快捷方式。

It is a shortcut to:

这是一个快捷方式:

C:\Users\Username\AppData\Local\GitHub\GitHub.appref-ms --open-shell

More recent versions of G4W (see answer below) could have it at:

更新版本的 G4W(请参阅下面的答案)可以在:

%LOCALAPPDATA%\Apps.0\...\...\
C:\Users\Username\AppData\Local\Apps.0\GitHub\GitHub.appref-ms --open-shell

If that shell complains about the absence of git, launch "G4W" itself, which will extract git.
See "Where is git.exelocated?".

如果该 shell 抱怨缺少git,则启动“G4W”本身,这将提取 git。
请参阅“位于何处git.exe”。

As mentioned below, to restore the shortcut, after having run the first command, execute in the Git shell:

如下所述,要恢复快捷方式,在运行第一个命令后,在 Git shell 中执行:

github --reinstall-shortcuts

回答by Dan

Try running the following command:

尝试运行以下命令:

github --reinstall-shortcuts

github --reinstall-shortcuts

That repaired the Git Shell shortcut for me, and also put the proper icon back.

这为我修复了 Git Shell 快捷方式,并且还放回了正确的图标。

回答by Hoodlum

I found out that the answer that you specifically wanted involves a combination of the previous answers: 1. Running the Git Shell via the command line (Since you lost the shortcut)

我发现您特别想要的答案涉及先前答案的组合: 1. 通过命令行运行 Git Shell(因为您丢失了快捷方式)

C:\Users\Username\AppData\Local\GitHub\GitHub.appref-ms --open-shell

2. Once youre in the Git Shell run the command in the previous answer

2. 进入 Git Shell 后,运行上一个答案中的命令

github --reinstall-shortcuts

You'll find the Git Shell with the grey cat icon that originally came with the GitHub setup in the desktop.

您会在桌面上找到最初随 GitHub 设置一起提供的带有灰色猫图标的 Git Shell。

回答by Lup

The direct link for Git Shell is now:

Git Shell 的直接链接现在是:

https://git-scm.com/downloads

https://git-scm.com/downloads

回答by C.K.

Windows 10
Git-2.19.0-64

Windows 10
Git-2.19.0-64

The Git Shell is installed by default in:

Git Shell 默认安装在:

C:\Program Files\Git\git-bash.exe

Try create a shortcut to your desktop, not sure if this answer your question.

尝试为您的桌面创建一个快捷方式,不确定这是否能回答您的问题。

回答by anshou

I ran into this same issue today, and since this is the first Google result for my query trying to find a solution, I'll post what I sorted here.

我今天遇到了同样的问题,因为这是我试图找到解决方案的查询的第一个 Google 结果,我将在这里发布我排序的内容。

It looks like GitHub for Windows installs some or all of itself into %LOCALAPPDATA%\Apps\2.0\...\...\* and this reference was broken on Git Shell .lnk shortcut on the desktop. The GitHub.exe file pointed to did not exist; the entire path was missing.

看起来 GitHub for Windows 将自身的部分或全部安装到%LOCALAPPDATA%\Apps\2.0\...\...\* 中,并且此引用在桌面上的 Git Shell .lnk 快捷方式上已损坏。指向的 GitHub.exe 文件不存在;整个路径都不见了。

I viewed properties on the .lnk file (select Properties from context menu or ALT+ENTER on keyboard with .lnk selected) and clicked the Change Icon button. A message box appeared noting that the path to the old icon file was missing and what the bad path was.

我查看了 .lnk 文件的属性(从上下文菜单中选择属性或在键盘上选择 .lnk 的 ALT+ENTER)并单击更改图标按钮。出现一个消息框,指出旧图标文件的路径丢失以及错误路径是什么。

I found the "current" path by poking about in the above noted directory and finding GitHub.exe again. The icon is one of three available in GitHub.exe; I expect this is what some of the other answers (like the reinstall-shortcuts suggestion) accomplish.

我通过在上面提到的目录中翻找并再次找到 GitHub.exe 找到了“当前”路径。该图标是 GitHub.exe 中可用的三个图标之一;我希望这是其他一些答案(如重新安装快捷方式建议)所完成的。

Hope this helps someone!

希望这可以帮助某人!

  • (Which seems to be normal for .NET ClickOnce applications; those ...are randomized/obfuscated/generated so they will look like gibberish. My specific workingpath, as an example, ended up being: C:\Users\anshou\AppData\Local\Apps\2.0\RZ33EP02.2J7\5OMOZAGM.89T\gith..tion_317444273a93ac29_0001.0003_e68db37a99107794-- note that this path is not truncated, that is the exact path, double period and all.)
  • (这对于 .NET ClickOnce 应用程序来说似乎是正常的;那些...是随机/混淆/生成的,所以它们看起来像胡言乱语。作为一个例子,我的具体工作路径最终是:C:\Users\anshou\AppData\Local\Apps\2.0\RZ33EP02.2J7\5OMOZAGM.89T\gith..tion_317444273a93ac29_0001.0003_e68db37a99107794--注意这条路径没有被截断,是确切的路径,双周期等等。)