Windows 上的 Git bash 控制台无法启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23201376/
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
Git bash console on windows does not start
提问by Ayusman
While trying to start a git bash window on any folder in my windows 7 machine, the git bash window closes right away.
尝试在我的 Windows 7 机器上的任何文件夹上启动 git bash 窗口时,git bash 窗口立即关闭。
I do this by clicking on the "Git Bash" option in the context menu.
我通过单击上下文菜单中的“Git Bash”选项来执行此操作。
When I try to start the Git Bash the console window starts temporarily for a few seconds and exits with a 'logout' message.
当我尝试启动 Git Bash 时,控制台窗口会临时启动几秒钟,然后退出并显示“注销”消息。
I tried to go to the Git installed location and run the "Git Bash.lnk" which exits with this message:
我试图转到 Git 安装位置并运行“Git Bash.lnk”,它以以下消息退出:
D:\DevProgs\Installed\Git-1.7.11\Git>"Git Bash.lnk"
Welcome to Git (version 1.7.11-preview20120710)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
AD@AYUSMAN /
$ logout
D:\DevProgs\Installed\Git-1.7.11\Git>
Is there something I am doing wrong? I had been able to use Git Bash without any issues on any folder so far.
有什么我做错了吗?到目前为止,我已经能够在任何文件夹上使用 Git Bash 而没有任何问题。
System Info: Windows 7 64 bit professional edition. Git 1.7.11
系统信息:Windows 7 64 位专业版。git 1.7.11
回答by Sam Wilson
This suddently started happening for me also. I upgraded to Git version 1.9.5 but nothing changed.
这突然也开始发生在我身上。我升级到 Git 版本 1.9.5 但没有任何改变。
The shortcut was using the following command: "C:\Program Files (x86)\Git\bin\sh.exe" --login -i
and exiting with this bad-looking guru meditation:
快捷方式是使用以下命令:"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
并退出这个看起来很糟糕的大师冥想:
PS C:\Program Files (x86)\Git\bin> .\sh.exe
0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x0, BaseAddress 0x68570000, RegionSize 0x460000, State 0x10000
C:\Program Files (x86)\Git\bin\sh.exe:
*** Couldn't reserve space for cygwin's heap, Win32 error 0
So I changed the shortcut to launch Bash instead: "C:\Program Files (x86)\Git\bin\bash.exe" --login -i
and all was fixed.
因此,我更改了启动 Bash 的快捷方式:"C:\Program Files (x86)\Git\bin\bash.exe" --login -i
一切都已修复。
回答by amoncadot
Fixed this by:
修复了这个:
- Open CMD as Admin
- CD to the installation path of GitHub (e.g. CMDPRMPT> CD "C:\Program Files\Git")
- Run "git-bash.exe" from command prompt
- Right-click the GIT BASH icon on the taskbar and pin it so you can avoid steps 1-3 in the future.
- 以管理员身份打开 CMD
- CD到GitHub的安装路径(例如CMDPRMPT> CD "C:\Program Files\Git")
- 从命令提示符运行“git-bash.exe”
- 右键单击任务栏上的 GIT BASH 图标并将其固定,这样您就可以避免将来执行步骤 1-3。
OS Version: Windows 7
操作系统版本:Windows 7
GIT version: 2.15.0
GIT 版本:2.15.0
Hopefully this helps!
希望这会有所帮助!
回答by sanchit verma
just open git-Bash.exe as admin this worked for me
只需以管理员身份打开 git-Bash.exe 这对我有用
回答by Eric Wang
Try git v1.8.4 for windows, it works fine to me.
It seems newer version can't use https git push.
为 Windows 尝试 git v1.8.4,它对我来说很好用。
似乎较新的版本不能使用 https git push。
回答by Ayusman
The problem was my Kaspersky antivirus. I had to re-install Git and add the Git exe (and other associated Git executable) to safe list of Kaspersky safe list. It took quitesometime to work, but seems to be working fine now.
问题是我的卡巴斯基防病毒软件。我不得不重新安装 Git 并将 Git exe(和其他相关的 Git 可执行文件)添加到卡巴斯基安全列表的安全列表中。工作花了很长时间,但现在似乎工作正常。