Git error fatal: Authentication failed

2020-02-16 06:09发布

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 cmds:

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

git push -u origin -–all

Any idea of the fix for this?

Thanks!

13条回答
成全新的幸福
2楼-- · 2020-02-16 06:57

I had the same problem, I tried to update my password using windows credential manager, it still didn't fix the issue

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

I then deleted all the git related entry in credentials manager and then tried to use Git using visual studio, this time it prompted for new credentials

查看更多
贼婆χ
3楼-- · 2020-02-16 06:59

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.

查看更多
Emotional °昔
4楼-- · 2020-02-16 06:59

I had this problem and the instructions from a tech at Microsoft fixed it for me:

  • Close all instances of Visual Studio.
  • Open the Task Manager and check if any TFS Services are running. Select each of them and click on End Process Tree.
  • Browse to the folder below and delete all the contents and folders in %LocalAppData%\Microsoft\Team Foundation{version}\Cache
  • Go to Control Panel -> User Accounts -> Manage your Credential -> Windows Credential, select the VSTS URL to remove it
  • Then go to "C:\Users\USER NAME\AppData\Local\GitCredentialManager\tenant.cache" and delete it
  • Also go to "C:\Users\USER NAME\AppData\Local.IdentityService" and delete it
查看更多
forever°为你锁心
5楼-- · 2020-02-16 07:03

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

查看更多
放荡不羁爱自由
6楼-- · 2020-02-16 07:05

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

查看更多
贼婆χ
7楼-- · 2020-02-16 07:07

I suddenly started receiving this error when attempting to push changes from VS2017 to a VSTS Git repository. This functionality had worked the day before.

I checked my git.log file and saw a different exception :-

19:43:57.116665 ...zureAuthority.cs:184 trace: [ValidateCredentials] server returned: 'Unable to connect to the remote server.

I downloaded the latest Git CredentialManager source from Gits Credential Manager repo and debugged it.

Once authenticated, the following exception occurred :-

No connection could be made because the target machine actively refused it 127.0.0.1:8888

I then realised that I had recently setup Fiddler to act as a proxy for all services as per the article capturing-traffic-from-.net-services-with-fiddler

Once I ran Fiddler, I was able to successfully connect.

查看更多
登录 后发表回答