Authentication failed for https://xxx.visualstudio.com/DefaultCollection/_git/project

I am trying to use git to push my repository to a visual studio team services project, but I get the error:

fatal: Authentication failed for (url of team project)

I am using the commands:

git remote add origin
     https://XXXXXXX.visualstudio.com/DefaultCollection/_git/project

git push -u origin -–all

Any idea of the fix for this?


I had a same issue recently (visual studio 2017 & Windows 10), and solved it using the following method:

Control Panel --> Credential Manager --> Manage Windows Credentials --> Choose the entry of the git repository, and Edit the user and password.

Done.


If you wish to use GIT CLI and not interact with the build in GIT wrappers in Visual Studio you need to enable Alternate Authentication Credentials

How?

Open your account (VS Online account) 
-> click on your name on the top right 
-> My Profile
-> Credentials.

and set it up.


enter image description here

enter image description here