Learn why this exception appears when trying to open a new cygwin terminal in windows and how to solve it.

How to solve Cygwin Terminal Error: Could not fork child process: There are no available terminals (-1)

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:

Task Manager Windows Kill process SSH.exe

After killing the mentioned process, you will be able to open a new Cygwin terminal without any issue.

Happy coding !

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.