Attempting push on git and receiving "could not read Username for 'https://github.com': terminal prompts disabled"
Solution 1
As per my comment. You can include your username in the remote URL (similar to FTP).
Example without password (SSH):
git remote set-url origin [email protected]/username/repo.git
Example with password (https)
https://name:[email protected]/username/repo.git
Source: Git push requires username and password
Updated 5/14/2018 to correct github.org
to github.com
in the original answer
Solution 2
This worked for me:
Deleting the file %localAppData%\GitCredentialManager\tenant.cache and then re-trying your logon.
Solution 3
Check that Windows does not have a pending update. If it does, update and restart.
Solution 4
This happened to me when syncing. Updating visual studio to the latest version did it for me.
Solution 5
In windows go to credentials manager and check if generic credentials list has the below entries
If these entries are not present add these entries with username and password and it should work.
Related videos on Youtube
Matt
Big fan of Java, PHP, C#, MYSQL and chocolate No longer a big fan of Delphi and Actionscript 3
Updated on December 15, 2020Comments
-
Matt over 3 years
I'm using Visual Studio, and the GitHub Extension. I am able to sign in, then clone my team's repository, and then pull changes successfully.
When it comes time to push my changes back to remote, I get a blank command prompt appear on the screen briefly, and then the following errors in the output window:
Error encountered while pushing to the remote repository: Git failed with a fatal error.
fatal: AggregateException encountered. One or more errors occurred.
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://github.com': terminal prompts disabled
EDIT: pushing via the command line works, as does pushing via the GitHub desktop application, just not within this extension.
Any ideas why this might be happening? I can't see why it needs the Username given that I have signed into the extension.
-
Taylor Ackley about 7 yearsDo you use a password extension? It might be blocking the User Access Control. You could also revise your remote url to include your username. stackoverflow.com/questions/6565357/…
-
Matt about 7 years@TaylorAckley thanks, I thought I tried everything in the other questions but didn't see this one hiding away. Adding the username to the remote url was the only thing that worked (I have no password extension or anything unusual like that). If you add it as an answer I'll accept it.
-
JosephDoggie over 4 yearsI was able to solve this by getting a 'access token' credential (that works between Visual Studio and Azure-Devops) and re-booting the computer hosting Visual Studio. I don't know if this is a general solution or not.
-
-
Stefan Steiger about 6 yearsActually, git remote set-url origin username:[email protected]/username/repo.git but thanks anyway. Save me from the sysadmin.
-
Jay S over 5 yearsThis was it for me. Updating Visual Studio was required before it would allow me to do a push.
-
Alex KeySmith over 5 yearsFor other people reading this, be wary of sslVerify - false it poses a security risk and opens you to man-in-the-middle attacks. This might be a valid solution for Andi, but not for everyone so please be wary. A more robust solution to corporate environments is adding the certificate of the proxy to the trusted root certificates (a separate discussion).
-
maximus about 5 yearsIn addition, when putting your password into the repo url, you need to replace special characters with their corresponding URL encoded values, for example: myp@ssword --> myp%40ssword
-
Taylor Ackley over 3 years@Morgs see the above comment from maximus.
-
Tomer Shetah over 3 yearsWelcome to SO! Please read the tour, and How do I write a good answer?
-
Prakash about 3 yearsFor me also restarting VS 2019 solved it.
-
kev almost 2 yearsWhere would you set this in visual studio? It seems to spawn a new terminal which doesn't know about this setting.