Many answers here are suggesting different processes they need to kill in order to be able to open a new Git Bash terminal. In my case there were multiple conhost.exe
processes running which I had to kill before I could open another window successfully.
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:
Opening a new Git Bash Window starts the following processes:
- conhost.exe
- git-bash.exe
- git.exe
- mintty.exe
Now, when you type git log
, 4 additional processes open:
- bash.exe
- conhost.exe
- git.exe
- less.exe (this will only stay open if your log cannot fit on one screen)
When you close Git Bash, those 8 processes all normally go away. However, due to a bug, (which I think is possibly in less.exe
) when you resize the window while viewing the log, Git Bash hangs. If you now close the window only 6 of the 8 processes close. Both less.exe
and conhost.exe
stay active. In my case, eventually enough conhost.exe
processes built up and caused whatever the issue is that leads Git Bash displaying the error and not starting.
That said, I tried to repeat the issue but gave up after 20+ tries, which was more conhost processes than I had to kill when I was in the problem state. I suspect it’s not a process number but something about the state of one or more processes that leads to the error. Obviously since other answers mention closing different processes, the «thing» that isn’t closing properly and fighting against Git Bash can vary, depending on what tools you’re using.
Note, I’m using Git version: 2.37.1.windows.1.
Learn why this exception appears when trying to open a new cygwin terminal in windows and how to solve it.
After experimenting with some SSH tools of Cygwin that allow me to use the stored SSH keys on the Pageant utility of Putty in Windows, closing the window normally and trying to open a new one leads to the error mentioned in this article. For my surprise this doesn’t happen only to Cygwyn but to other tools like Git Bash. The error is caused (as i though) for the SSH tools that i decided to start and use. The problems is that the ssh connections you made on the git bash or cygwin shells aren’t being closed, which lets the available shell hanging and unavailable.
The solution is pretty simple, stop the active SSH service in your system either from the command line or using the task manager of Windows:
From the command line
Open a new terminal (cmd.exe
) and run the following instruction:
taskkill /F /IM ssh.exe
The taskkill
command finishes the given process that in this case is ssh.exe
.
Graphically with the task manager
If you want to do it graphically, start the Task Manager of windows (taskmgr.exe
) and search for ssh.exe
(and ssh-pageant.exe
if listed) and end those tasks:
After killing the mentioned process, you will be able to open a new Cygwin terminal without any issue.
Happy coding !
У меня было до 8 терминалов git bash, работающих одновременно.
В настоящее время у меня только 2 вверх.
Я не видел эту ошибку раньше, и я не понимаю, что является причиной этого.
Любая помощь будет оценена!
Картинка прилагается:
Ответы:
Нашел похожую проблему и решение в группах Google
Я открыл командную строку Windows и запустил команду
$ tasklist
Похоже, что ssh-соединения, которые я установил в своих оболочках git bash, не были закрыты, когда эти окна были закрыты, и висели доступные окна оболочки git bash.
Это может быть опасным решением, но из командной строки Windows я запустил
$ taskkill /F /IM ssh.exe
После этого все снова работает. Возможно, это напрямую не было проблемой бесхозных процессов, но это работало, по крайней мере, для меня.
Дополнительное примечание: вы также можете убить другие процессы, например:
$ taskkill /F /IM vim.exe
Я вижу проблему с окнами в git bash, когда убиваю консоль git bash, не используя выход. Я нашел убийство ssh-agent.exe из диспетчера задач Windows, чтобы решить эту проблему.
В моем случае это было связано с использованием кода VS. Ранее я открыл код VS с помощью терминала git bash и выполнил
code .
затем закрытие терминала.
Проблема решается путем закрытия всех открытых окон кода VS.
Если у вас есть какой-либо редактор или IDE, настроенный для открытия терминала как git bash, то когда IDE / IDE работает, git bash будет раскручивать bash из «C: Windows System32 bash.exe» и любые другие попытки открытие bash из отдельного окна может привести к сбою.
Лучшее решение — убить панель IDE / Editor и открыть ее из нового окна или продолжить с помощью команды IDE / Editor.
Я обращаюсь к этому с обходным путем:
- Закройте окно Git Bash.
- Откройте диспетчер задач.
- Найдите процесс Git для Windows.
- Убей это.
- Откройте Git Bash.
Теперь все должно быть в порядке.
Чтобы облегчить жизнь (такие проблемы случаются довольно часто), создайте файл с именем fixbash.bat
в домашнем каталоге и вставьте его:
taskkill /F /IM ssh-agent.exe
Когда проблема возникает, просто откройте cmd
и введите, fixbash.bat
чтобы решить проблему.
Или
Просто вставьте команду taskkill в вашу, cmd
если вы не хотите создавать скрипт.
Перезагрузите машину.
(Другие ответы у меня не сработали. (Я не пробовал переустанавливать. Вероятно, перезапуск быстрее).)
Для меня (или кто работает транспортир, который может раскрутить автономный Селен / WebDriver сервера), мне нужно taskkill
в конкретной WebDriver , который работает мои тесты.
Так что просто другой аргумент: или ваша версия chromedriver может отличаться
taskkill /f /im chromedriver_2.34.exe
Обратите внимание, что ваш драйвер может отличаться:
IEDriverServer*.*.*.exe
противchromedriver_*.**exe
Ваш водитель может версия может меняться: chromedriver_2.34.exe
противchromedriver_2.33.exe
Эта проблема усугубилась после того, как транспортир вышел из системы, не закрыв браузер с автоматическим / тестовым управлением (из-за отдельной проблемы, которую я пока не понимаю). Естественно, многие chromedriver
задачи остаются запущенными, поэтому убивают их.
Откройте диспетчер задач и убейте процесс с именем bash, у меня это сработало.
Это происходит при выходе из git bash без прекращения существующего процесса. Просто попробуйте убить те процессы, которые вы начали с git bash. Я запускал процесс узла внутри git bash, поэтому я убил все процессы узла
- Открыть диспетчер задач
- Перейти к вкладке «Сведения»
- Ищите node.exe (вы ищите свои процессы)
- Убей это каждый процесс узла
- Снова откройте Git Bash
наконец-то выяснили, что это вызвало.
если мы используем такой код (явно или неявно), т.е. в .bashrc
файле
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
это порождает новый процесс.
Если вы не выходите из него и просто закрываете окно, этот процесс все еще выполняется. поэтому каждый новый открытый bash просто продолжает добавлять новые без утилизации старых.
когда закончите с окном bash, просто нажмите ctrl+d
или введите, exit
чтобы убить процесс агента, и у вас не должно быть разветвлений.
Кажется, проблема действительно связана с процессами, запускаемыми из git bash, как @mamacdon, предложенный в комментарии к главному ответу @Scott Newson.
Для меня проблема появилась, если я запустил vscode из bash с code
, и если этот экземпляр vscode запустил интегрированный терминал git, когда исходный bash еще работал.
Неважно, был ли этот терминал запущен в начале или позже, если он был в то время, когда оригинальный bash еще работал.
Не произошло, когда bash был закрыт до открытия интегрированного терминала. Не различатьexit
закрытием bash через окна. Не случилось с другим старым окном bash, все еще работающим.
Для меня было возможно закрыть терминалы в vscode с помощью exit
или «Kill Terminal» (будьте осторожны, чтобы не перепутать это с «закрыть панель»), или, конечно, закрыть сам vscode.
Если вы получили эту ошибку, попробуйте вспомнить, что вы запустили из bash, и убейте ее. Если другие ответы сработали для вас, возможно, это просто вещи, запущенные вашим bash или запущенные процессами, которые вы запустили из bash, и они каким-то образом стали потомками вашего исходного bash.
Если вы используете код Visual Studio и не можете найти ssh-agent.exe или не можете выполнить задачу, и после открытия Git Bash вы получаете эту ошибку, просто перейдите в VSCode, откройте «Терминал»> «Новый терминал» и просто нажмите значок корзины. (Убить Терминал). например (1: bash), если у вас есть несколько, просто убейте их всех, и вы должны быть хорошими.
В моем случае мне нужно убить Git Bash в Windows. Так открыл командную строку и запустил ниже команды
$ tasklist
В нем будут перечислены все запущенные задачи, затем необходимо убить задачу bash.exe, используя следующую команду
$ taskkill /F /IM bash.exe
Откройте диспетчер задач, найдите «sh» и убейте их. Удачи
В моем случае решением было закрыть код Visual Studio — там, где у меня тоже была консоль, не замечая —
После закрытия все возвращается на круги своя. Надеюсь, это кому-нибудь поможет.
Я попытался убить все мои git-терминалы в диспетчере задач, решает проблему. Это работает и для меня. удачи.
В более поздней версии git для windows процесс, который нужно было убить в диспетчере задач, был «GitExtensions.exe». Убил это и терминалы перезапустились без проблем.
Найдите процесс ssh-agent в окне диспетчера задач. После того, как вы остановите или убьете процесс ssh-agent, ошибка исчезнет.
В моем случае я запустил код Visual Studio и закрыл его, что решило проблему.
Переустановил мерзавец, теперь работает нормально.
я обнаружил, что убийство терминала msys2 в диспетчере задач решает проблему
Откройте диспетчер задач, найдите процесс bash.exe и убейте его. Помогло в моем случае.
Windows 10 это работало для меня:
1) открыть cmd от имени администратора
2) тип:
taskkill /f /im git-bash.exe
3) Если произошла ошибка: процесс «ssh-agent.exe» не найден. затем:
тип:
tasklist
4) Найдите и уничтожьте каждый процесс словами «bash» или «git» (это может быть опасным решением, но как только вы найдете имя процесса, в следующий раз вы узнаете.)
taskkill /f /im ***.exe
Для windows, в диспетчере задач убей sh.exe.
В моем случае у меня был запущенный файл abd.exe, который все еще был открыт в диспетчере задач. Убийство решило проблему.
В системе Bash тип:
ps
Убить любой плохо выглядящий процесс:
kill -9 <ID>
Работал на меня.
Просто перезагрузите свою машину, пока перезагрузите нашу машину, эта проблема решена попробуйте.
Issue
I have had up to 8 git bash terminals running at the same time before.
Currently I have only 2 up.
I have not seen this error before and I am not understanding what is causing it.
Any help would be appreciated!
Picture attached:
Solution
Found a similar issue and solution in google groups
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.
Additional note: you can also kill other processes, for example like:
$ taskkill /F /IM vim.exe
Answered By – Scott Newson
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0
Git bash Error: Could not fork child process: There are no available terminals (-1)
https://stackoverflow.com/questions/45799650/git-bash-error-could-not-fork-child-process-there-are-no-available-terminals
I have had up to 8 git bash terminals running at the same time before.
Currently I have only 2 up.
I have not seen this error before and I am not understanding what is causing it.
Any help would be appreciated!
Picture attached:
killing the bash process worked for me. — bfranzen
-1 to all current answers. All variations of “just kill terminal and start again”. What’s the underlying problem? Why can’t I have 100 terminals? — RJFalconer
I’ve had this issue for such a long time and never been able to get to the bottom of it. It seems to be applications that are left open which can cause some handles to remain open, but in my case the bash processes were being closed and there are no ssh processes around (I’m using mosh
). I’ve just been able to replicate the issue by launching vscode using vscode .
and then closing the terminal used to open it. While the vscode window stays open it seems Cygwin doesn’t want to open more terminals, as soon as I close it, it works. — Elven Spellmaker
@ElvenSpellmaker you’re right, it has to do with code .
in my case as well. — Bilal Khoukhi
Just for the sake of confirmation: Encountered the problem today, was also due to code .
in my case. Closing VS Code cleared the issue. Great find @ElvenSpellmaker — kb.
Found a similar issue and potential solution here: https://groups.google.com/forum/#!topic/git-for-windows/EO27WWvHx64
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 will give this a try shortly! I am just afraid to kill off some tasks while i have some things running — A. Petrizza
This procedure worked, although in my case the culprits were node.exe
(Node.js) and link.exe
(GNU link). So you may have to hunt through the tasklist for the guilty processes. I’m not sure why, but it does seem like programs launched from inside Bash sessions can somehow out-live their parent shell. — mamacdon
Thank you scott, this procedure worked by as mentioned by @mamacdon even in my case culprits was node.exe. — S52
For me, I had to perform “taskkill /F /IM ssh-agent.exe” but close enough for an up-vote. — Dylan Kapp
I had to kill node.exe with the command taskkill /F /IM node.exe
— Tarator
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.
This worked initially. Now I still get it, even after killing ssh-agent.exe. — Leo
this is a short term solution. the problem returns eventually. hoping there is a more permanent way to fix this issue — Sonic Soul
I address this with a workaround:
- Close the Git Bash window.
- Open Task manager.
- Find the ‘Git for Windows’ process.
- Kill it.
- Open Git Bash.
It should be ok now.
This worked for me. Thanks! — JimB814
easiest solution. So straightforward. — JkAlombro
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.
Restart your machine.
(The other answers did not work for me. (I didn’t try reinstalling. Restarting is probably faster.))
Open task manager and kill process with name bash, this worked for me.
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.
Yep, this was my problem. I have convenience script that uses Selenium to fetch some stuff from some web sites where curl and wget cannot be used due to having to process JavaScript. Anyway, I usually run this once in the morning and sometimes it gets hung up. I never made the correlation with this cygwin error until I saw this post, so THANKS! I’m going to update the script that calls selenium to kill the chromedriver.exe process before exiting. — beaudet
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
- Open Task Manager
- Goto Details Tab
- Look for node.exe(you look for you processes)
- Kill it each and every node process
- Open Git Bash again
In my case it was adb shell
. So I ran adb kill-server
in an already open window and it fixed that for me. +1 — lucidbrot
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.
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.
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.
Open your Task manager, search “sh” procces and kill them. Good luck
I tried to kill all my git terminals in task manager solves the problem. This works for me too. good luck.
Please find the ssh-agent process in the Task Manager window. After you stop or kill the ssh-agent process the error will disappear.
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.
Reinstalled git, it is now working fine.
i found that killing msys2 terminal in task manager solves the problem
In my case I had visual studio code running and closing it resolved the issue.
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.
ft_authoradmin ft_create_time2019-07-05 14:17
ft_update_time2019-07-05 14:18
Found a similar issue and solution in google groups
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.
Additional note: you can also kill other processes, for example like:
$ taskkill /F /IM vim.exe
In my case, it was related with the use of VS code. Previously I have opened 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.
When you have any editor or IDE configure to open a terminal as git bash, then when the IDE/IDE is running, the git bash will spin up bash from «C:WindowsSystem32bash.exe» and any other attempt to open bash from a separate window is likely to crash.
The best solution is to kill the IDE/Editor bash and open from a new window or continue from the IDE/Editor command.
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.