Git 2.7.2.windows.1 fails to authenticate access to private repository over HTTPS
- From
- zacr <zacr@slingshot.co.nz>
- Date
- Feb 29, 2016, 03:24 UTC
- Message-ID
- <0eee43fe410bb5db3dc8eeec2f7ff00c@slingshot.co.nz>
Hi,
I have recently downloaded 64-bit Git for Windows (the file I downloaded was "Git-2.7.2-64-bit.exe"). This reports a version string of "git version 2.7.2.windows.1" Using it from the command line, after cloning a repository, I attempted to "git pull" a private repository from GitHub. From prior experience, I expected it to ask me for my username and password, then authenticate with the server. It asked for my username, which I typed in, but after pressing Enter it suddenly failed with an error:
error: failed to execute prompt script (exit code 1) fatal: could not read Username for 'https://github.com': Invalid argument
I experimented a bit, and it only occurs when trying to use HTTPS to pull from a repository that requires authentication. Using a personal access token to authenticate or using the git protocol both work.
I ran it again with GIT_TRACE=true, and here is the trace (with username and repository name removed):
15:55:58.615147 git.c:348 trace: built-in: git 'pull' 15:55:58.617147 run-command.c:343 trace: run_command: 'fetch' '--update-head-ok' 15:55:58.633149 git.c:348 trace: built-in: git 'fetch' '--update-head-ok' 15:55:58.636149 run-command.c:343 trace: run_command: 'git-remote-https' 'origin' 'https://github.com/username/repository.git' 15:55:59.630248 run-command.c:343 trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"' error: failed to execute prompt script (exit code 1) fatal: could not read Username for 'https://github.com': Invalid argument
It looks like it's trying to run a new bash instance for me to enter my password, which fails on Windows because I don't have bash installed.
For reference, here are some old threads I found while researching the issue. It looks like this has cropped up before, in Git 1.8.5. https://groups.google.com/forum/#!msg/msysgit/s4dB8Nv9V4c/55-cGPdPYmAJ https://github.com/msysgit/msysgit/issues/153 and stackoverflow for good measure (comments by Mr_and_Mrs_D, Ricardo, and AndyL identify it as a bug with 1.8.5): http://stackoverflow.com/questions/20871549/error-when-push-commits-with-github-fatal-could-not-read-username
I would appreciate your help.
Yours sincerely, Zac Roberts zacr@slingshot.co.nz