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

225,665

Solution 1

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.

Solution 2

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

Solution 3

I have faced the same issue. The error output window looks like this: authentication failed Image

Following the steps resolved the issue:

  1. Go to Control Panel --> Credential Manager --> Windows Credentials
  2. Below Generic Credential, choose an entry of the git & update password.

    solution window

  3. Password should be same as windows(system) login password.

Solution 4

The best option today is to install https://github.com/Microsoft/Git-Credential-Manager-for-Windows that supports VSO, GitHub and is improving every month.

Solution 5

With VSTS the url is, When you copy git clone url from vsts you always get

https://orgname@dev.azure.com/org/project/_git/repo

Replace orgname@ with your alternate username that you would have created in VSTS -> profile -> Security.

final git url -

https://alternateusername@dev.azure.com/org/project/_git/repo

Share:
225,665
GurdeepS
Author by

GurdeepS

Updated on February 10, 2022

Comments

  • GurdeepS
    GurdeepS about 2 years

    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?

  • Lukos
    Lukos over 7 years
    Security is a separate item in the menu now. If you click profile, it goes to a very different page.
  • CodeWizard
    CodeWizard over 7 years
    it may vary between versions. this is why i added screenshot
  • Deilan
    Deilan almost 7 years
    @dotnetdev Please accept this answer 'cause this is a recommended way of resolving the issue.
  • Breeno
    Breeno over 6 years
    This is also available for Mac and Linux at github.com/Microsoft/Git-Credential-Manager-for-Mac-and-Linu‌​x - worked perfectly for me without having to add less-secure "alternative credentials".
  • Stephane
    Stephane over 5 years
    This is indeed the "de facto" solution that microsoft provided. Other solutions that indeed work here shall be considered as tweaks.
  • Josh Gust
    Josh Gust over 5 years
    I have not had to do this. Using a PAT for Git Bash seems to be working just fine.
  • Edward Thomson
    Edward Thomson about 5 years
    Please use a PAT instead of alternate credentials.
  • Even Mien
    Even Mien almost 5 years
    I used this method when my Personal Access Token expired. Go to <<URL>>/_usersSettings/tokens to create a new one and then set it as the password in Credential Manager.
  • Highriser
    Highriser over 4 years
    Start-> Windows Credentials works like a charm! Thanks!
  • Giulio Vian
    Giulio Vian over 4 years
    Enabling Alternate credential is not recommended: domain credentials transit in clear-text and may ends up in Application Tier IIS logs
  • marcogmonteiro
    marcogmonteiro over 3 years
    OP didn't said anything about this being in cpanel.
  • Dominik Sajovic
    Dominik Sajovic over 3 years
    God.... thank you. This is the only solution that worked for me.
  • bryanbcook
    bryanbcook over 3 years
    I have multiple logged in credentials -- this was the easiest and most direct way to ensure that it uses the correct cached credential.
  • Enrico
    Enrico about 3 years
    "Alternate credentials have been disabled on this organization"
  • Kevin
    Kevin almost 3 years
    I only had to delete the entry from Windows Credentials to resolve my issue.
  • Namitha
    Namitha almost 3 years
    @Kevin - You have to Edit User name and password in windows credentials, then it will resolve.
  • JKH
    JKH almost 3 years
    This worked for me as well. Good solution.
  • Slavik N
    Slavik N almost 3 years
    The answer needs to be improved, to include explanations.
  • Pavan N
    Pavan N over 2 years
    on giving my machine password didn't worked, i generated personal access token (PAT) from VSO and used it. then in VS2019 am able to pull latest.