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

依然范特西╮ 提交于 2019-12-02 14:15:49
Scott Newson

Found a similar issue and potential solution in google groups

I'm not sure if you guys are still having a problem with this, but I found a very simple fix that worked for me.

I opened a windows command prompt and ran the command

$ tasklist

It looks as though the ssh connections I had made in my git bash shells weren't being closed when those windows were closed and were hanging the available git bash shell windows.

This may be a dangerous solution but from the windows command prompt I ran

$ taskkill /F /IM ssh.exe 

Everything appears to be working again after this. It may not have directly been an issue of orphan processes, but this worked for at least for me.

Good luck!

I see the problem on windows in git bash when I kill my git bash console without using exit. I found killing ssh-agent.exe task from windows task manager to fix the problem.

I address this with a workaround:

  1. Close the Git Bash window.
  2. Open Task manager.
  3. Find the 'Git for Windows' process.
  4. Kill it.
  5. Open Git Bash.

It should be ok now.

Restart your machine.

(The other answers did not work for me. (I didn't try reinstalling. Restarting is probably faster.))

For me (or anyone running protractor, which may spin up a standalone Selenium/WebDriver server), I needed to taskkill the specific webdriver which was running my tests.

So just a different argument: or your chromedriver version may vary

taskkill /f /im chromedriver_2.34.exe

Note your driver may vary: IEDriverServer*.*.*.exe vs chromedriver_*.**exe

Your driver may version may vary:chromedriver_2.34.exe vs chromedriver_2.33.exe

This problem got worse after protractor quit without closing the automated /test-driven browser, (due to a separate issue I don't yet understand.) Naturally many chromedriver tasks remain running, that's why kill them.

Open task manager and kill process with name bash, this worked for me.

This happens when you exit git bash without terminating existing process. Just try and kill those processes that you started from git bash. I was running node process inside git bash, so I killed all node processes Steps to kill

  1. Open Task Manager
  2. Goto Details Tab
  3. Look for node.exe(you look for you processes)
  4. Kill it each and every node process
  5. Open Git Bash again

To make life easier (this problems happens quite often) create a file called fixbash.bat in home directory and paste this:

taskkill /F /IM ssh-agent.exe

When problem occurs just open cmd and type fixbash.bat to fix a problem.

Or

Just paste the taskkill command into your cmd if you don't want to create a script.

In my case, it was related with the use of VS code. Previously I have openen VS code using a git bash terminal and executing

code .

then closing the terminal.

The problem is solved by closing all the VS code windows opened.

Sam96

Seems to be an issue with the processes launched from the git bash indeed, like @mamacdon suggested in his comment on the top answer by @Scott Newson.

For me, the issue appeared if I launched a vscode from the bash with code, and if this instance of vscode launched an integrated git terminal while the original bash was still running.

Doesn't matter whether that terminal was launched at the start or later, as long as it was while the original bash was still running.

Didn't happen when the bash was closed before the integrated terminal was opened. Didn't differentiate between exit and closing bash via windows. Didn't happen with another older bash window still running.

The way to deal with it was for me to close the terminals in vscode with exit or 'Kill Terminal' (be careful not to mix that up with 'close pane'), or of course, closing vscode itself.

If you get this error try to remember what you launched from the bash and kill it. If the other answers worked for you, it's probably just that these are the things launched by your bash or launched by processes you launched from the bash and they somehow were getting a child of your original bash.

finally figured out what was causing this.

if we use code like this (explicitly or implicitly) i.e. in .bashrc file

eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa

it spawns a new process.

if you don't exit it and just close the window, that process is still running. so each new bash opened just keeps adding new ones w/out disposing old ones.

when done with a bash window, simply hit ctrl+d or type exit to kill the agent process, and you should not run out of forks.

Open your Task manager, search "sh" procces and kill them. Good luck

If you are using Visual Studio Code and you can't find ssh-agent.exe or can't taskkill it and after opening Git Bash you get that error, just go to your VSCode open Terminal>New Terminal and just press the trashbin icon the (Kill Terminal). e.g (1:bash) if you got multiple then just kill them all and you should be good.

I tried to kill all my git terminals in task manager solves the problem. This works for me too. good luck.

On a more recent version of git for windows, the process to kill in task manager was "GitExtensions.exe". Killed that and the terminals restarted with no issues.

Please find the ssh-agent process in the Task Manager window. After you stop or kill the ssh-agent process the error will disappear.

prathesh p

Reinstalled git, it is now working fine.

In my case I had visual studio code running and closing it resolved the issue.

Windows 10 this worked for me:

1) open cmd as administrator

2) type:

taskkill /f /im git-bash.exe


3) If there was an Error: The process "ssh-agent.exe" not found. then:

type:

tasklist

4) Find and kill every process with words like "bash" or "git" (This may be a dangerous solution, but once you will find the process name, next time you will know.)

taskkill /f /im ***.exe

i found that killing msys2 terminal in task manager solves the problem

Open Task manager, find bash.exe process and kill it. Helped in my case.

In system bash type:

ps

Kill any bad looking process:

kill -9 <ID>

Worked for me.

Just Restart Your Machine, While Restarting our machine this issue is solved try it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!