Cpo Design

Git failed with a fatal error with could not read Username

Pavel Svarc Thursday, October 19, 2017 12:56 AM
Git failed with a fatal error.
fatal: HttpRequestException encountered.
An error occurred while sending the request.
fatal: HttpRequestException encountered.
An error occurred while sending the request.
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://mysite.visualstudio.com': terminal prompts disabled

While working on this problem I have encountered multiple solutions I will list all of them here. Please use comments if you have different solution. 

Solution 1

1, Click on connections (the green plug icon)

2, Manage connection

Click on the project you are connect to that fails.  Now click on the project and click connect in bottom of the connection window.

After this if you click sync.

 

Solution 2

Close Visual Studio

Open it again and the connection will be restored.

 

Solution 3: Mapped profile

If you have like me have mapped profile to network location it could be this solution. Your git profile file has been synced to network drive that is not accessible. Easy check is can that I access my git profile file in the network location. In my case the file had no data in there.

After couple hours of investigation the solution is:

1, Create new instance of the git profile into my network path 

2, Ensure the software that is used for SYNC files is without problem (that was root cause of my problem)