I'm using v2.0.3 packaged with Git for Windows.
Anything I try to run in the console that requires user input does not accept the user input.
For instance, try to clone a git repo over ssh - it asks to trust the host - you're to hit "y" and enter. It accepts the Y and when you press enter it moves down a line, but doesn't pass the "y" to the program.
/e/dev/
$ git clone git@server:repo.git
Cloning into 'repo'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 <key>
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) y
Press ^C
/e/dev/
$ y
bash: y: command not found
The same happens with many applications (all?) requiring user input, like npm init - it walks you through all the questions perfectly fine, but once it gets to Ist this ok? (yes) it no longer responds to the enter key.
npm init:
/e/dev/test
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (test)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to E:\dev\test\package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes) yes
All the enter presses along the way work fine, but the last prompt fails
This sounds like the old pty problem (see e.g. #481), assuming you are using applications that are compiled for the Windows console rather than for MinGW MSYS (which Git is based on).
In the first example, it could be an openssl tool which is not the Git one but a Windows native version. While it's waiting at the prompt (for the "y"), try to find out which processes are running (ps in another window). Then find out where it's getting that from (e.g. type openssl).
About the second example, npm isn't part of the Git standard installation. What does type npm say?
Analysis will reveal this is not a mintty issue.
While it's hung at the openssh prompt:
$ ps
PID PPID PGID WINPID TTY UID STIME COMMAND
29836 19632 29836 10416 pty0 1049686 Apr 8 /usr/bin/bash
18520 29836 18520 28948 pty0 1049686 09:12:28 /mingw64/bin/git
24264 11940 24264 11328 pty1 1049686 09:12:36 /usr/bin/bash
19632 1 19632 19632 ? 1049686 Apr 8 /usr/bin/mintty
10540 24264 10540 14148 pty1 1049686 09:12:38 /usr/bin/ps
11940 1 11940 11940 ? 1049686 09:12:36 /usr/bin/mintty
putty.exe and plink.exer are running the in Windows Task Manager.
$ type openssl
openssl is /mingw64/bin/openssl
$ type npm
npm is /c/Program Files/nodejs/npm
While it is true that both of these are compiled for Windows, there was no issue running these with the old version of git/git bash/mintty. Neither of those applications were updated, just the git install, so something changed between 1.x and 2.x that made these no longer work.
In any case, is there a workaround? This is my highly-preferred terminal but I can't use a lot of things in it now.
I can hardly believe that the change from mintty 1.x to 2.x _alone_ may have caused this issue. What else has changed? You might try to recompile mintty 1.2 from source (to recompile an older version, remove "-Werror" from the Makefile; or I might provide a binary) for a test. Or restore an environment that works for you and then update mintty _only_ (e.g. by compiling it explicitly, or saving the current version and running it then). But likely this should be reported to the Git issue tracker.
Closing, see previous comment.
@jdforsythe did you resolve your issue? I'm experiencing the same thing.
The problem is not solved. Using a newer version of git bash [and presumably mintty] has solved some other issues but this is worse. Now npm init doesn't even ask the questions anymore.
The problem is not solved but it is not a mintty problem. See my comments above.
Also have this issue with Git Bash. Just hangs on Is this ok? (yes) on npm init.
See https://github.com/mintty/mintty/issues/540#issuecomment-208324906 above.
For anyone still having issues, I found these under "Known Issues" in Git for Windows Release Notes
- If configured to use Plink, you will have to connect with putty first and accept the host key.
- Some console programs, most notably non-MSYS2 Python, PHP, Node and OpenSSL, interact correctly with MinTTY only when called through
winpty(e.g. the Python console needs to be started aswinpty pythoninstead of justpython).
From what I understand, what is happening is that git bash uses the msys2 platform. When a program that is not compiled for the msys2 platform (e.g. plink) is executed within msys2, it might have some issues with user input and output.
Hope this helps.
Most helpful comment
For anyone still having issues, I found these under "Known Issues" in Git for Windows Release Notes
From what I understand, what is happening is that git bash uses the msys2 platform. When a program that is not compiled for the msys2 platform (e.g. plink) is executed within msys2, it might have some issues with user input and output.
Hope this helps.