我曾经有8个git bash终端同时运行。

目前我只有2个。

我以前没有见过这个错误,我不知道是什么原因造成的。

任何帮助都将不胜感激!

图片附件:


当前回答

打开任务管理器,用name bash杀死进程,这对我有用。

其他回答

这里的许多答案都建议他们需要杀死不同的进程,以便能够打开一个新的Git Bash终端。在我的情况下,有多个conhost.exe进程正在运行,我必须在成功打开另一个窗口之前杀死它们。

Perhaps more importantly, is why it happened. I think I know exactly what I did which led to this state. I noticed that when typing git log, if I then resize my Git Bash window, it would hang. (Pressing q would not exit the log and I could no longer type commands.) I ended up closing the window and opening another one. I was doing some testing of this repeatedly to see if I could figure out a solution to the freezing after resizing, and after doing this multiple times (probably around 10 times), I received the error in this question. The results of my testing are:

打开一个新的Git Bash窗口会启动以下过程:

conhost.exe git-bash.exe git.exe mintty.exe

现在,当你输入git log, 4个额外的进程打开:

bash.exe conhost.exe git.exe exe(只有当你的日志无法显示在一个屏幕上时,它才会保持打开状态)

当你关闭Git Bash时,这8个进程通常都消失了。但是,由于一个错误(我认为可能是在less.exe中),当您在查看日志时调整窗口大小时,Git Bash挂起。如果现在关闭窗口,8个进程中只有6个会关闭。less.exe和conhost.exe都保持活动状态。在我的例子中,最终建立了足够多的conhost.exe进程,并导致了导致Git Bash显示错误而无法启动的问题。

也就是说,我试图重复这个问题,但在20多次尝试后放弃了,当我处于问题状态时,这比我必须杀死的conhost进程要多。我怀疑这不是进程号,而是导致错误的一个或多个进程的状态。显然,由于其他答案提到关闭不同的进程,无法正确关闭和对抗Git Bash的“东西”可能会有所不同,这取决于您使用的工具。

注意,我使用的Git版本:2.37.1.windows.1。

对我来说(或者任何运行量角器的人,它可能会启动一个独立的Selenium/WebDriver服务器),我需要taskkill正在运行我的测试的特定WebDriver。

这是一个不同的论点: 或者你的chromedriver版本可能不同

taskkill /f /im chromedriver_2.34.exe

注意你的司机可能会有所不同: IEDriverServer*.*.*.exe vs chromedriver_*.**exe

您的驱动程序可能版本不同:chromedriver_2.34.exe vs chromedriver_2.33.exe

量角器在没有关闭自动/测试驱动浏览器的情况下退出后,这个问题变得更糟了(由于一个单独的问题,我还不明白)。当然,许多chromedriver任务仍然在运行,这就是为什么要杀死它们。

我尝试了下面的方法,对我来说很有效:

杀死所有现有的git.exe 在Windows凭证管理器的通用凭证部分下添加了我的BitBucket凭证。

在我的例子中,问题是[git_install_dir]/etc/nsswitch.conf文件

我之前遵循了这里给出的说明: https://cygwin.com/faq.html faq.using.startup-slow。 但这反而导致了“无法分叉”错误。 我错误的nsswitch.conf文件是:

passwd: files
group: files

所以我恢复了文件,问题解决了。现在我的[git_install_dir]/etc/nsswitch.conf是:

passwd: files db
group: files # db
db_enum: cache builtin
db_home: env windows cygwin desc
db_shell: env windows # cygwin desc
db_gecos: env # cygwin desc

在我的例子中,我在Git Bash中运行jupyter-notebook,并在没有关闭notebook的情况下关闭了终端。当我关闭所有运行的git bash终端并试图打开新终端时,这给了我一个错误:

Error: Could not fork child process: There are no available terminals (-1).

解决方案

taskkill /F /IM jupyter-notebook.exe

在那之后,我能够在git bash终端中运行命令。