"fatal: Authentication failed" with git-credential-manager
Asked Answered
H

8

9

I'm using Azure DevOps for the first time to host my next project. When I created an empty project on Azure Devops, I tried to clone it. While attempting to clone, it asked me for my password. I entered it and it says I have a wrong password but I know I'm typing my password correctly.

I then installed git-credential-manager for max/linux onto my mac. I tried to do a git pull from the remote origin, but it just prompted for a password like the first time and failed.

I also tried to use the "Create git credentials" feature on Azure Devops, in which I can specify a new password. That failed as well with the same error.

I submitted a GitHub issue on their repository here. Is there no way for me to clone my project? The url for my repository is in the form of https://[email protected]/....

Update: I tried this on my Windows machine and it gave me a popup to login and it worked fine.

Hinny answered 7/12, 2018 at 0:56 Comment(1)
Please check this link you will get the clear idea about git authentication - https://mcmap.net/q/22953/-authentication-failed-for-azure-gitLoveless
H
17

Make sure your git credential helper is declared to your local Git:

git config credential.helper

If the output is empty, type:

git config --global credential.helper manager-core

Then try again.

However, the OP AskYous correctly pinpoint another issue in the comment:

Can I tell it what my username is?
I think my username is my email address, because I use my organization account to sign in.

In that case, the URL would be:

https://me%[email protected]/yousefshanawany/<repo-name>/

Note the @ of the email must be percent-encoded.


Note that using a PAT (Personal Access Token) is an alternative mentioned by the OP, and mandatory if you have 2FA activated.


Update June 2019: This question was referenced in microsoft/Git-Credential-Manager-for-Mac-and-Linux issue 104, which just got closed with a comment from John Briggs from Microsoft:

I'd recommend trying GCM Core's macOS preview release


Maksym Pecheniuk points out in the comments:

solution for IntelliJ Idea: "Git IntelliJ "Authentication Failed”"

Hara answered 7/12, 2018 at 6:0 Comment(8)
Thanks. I tried it but received the same response: i.imgur.com/BJuumPw.pngHinny
@Hinny What does git remote -v returns?Hara
The URL seems strange: it should be https://<you>@dev.azure.com/<you>/yourRepo: I am not familiar with the _git/xxx part.Hara
I tried the old URL on my windows machine and it worked fine. Got the UI login screen. I tried the new URL on my mac and it says: Cloning into '<repo-name>'... fatal: repository https://[email protected]/yousefshanawany/<repo-name>/' not foundHinny
@Hinny Is it possible to try with an URL without a trailing slash?Hara
Can I tell it what my username is? I think my username is my email address because I use my organization account to sign in.Hinny
@Hinny If it is, don't forget to percent-encode the @ (%40: en.wikipedia.org/wiki/…)Hara
solution for IntelliJ Idea - https://mcmap.net/q/1169909/-git-intellij-quot-authentication-failedUnbolted
S
10

What solved my issue was:

  1. Create the repository from https://dev.azure.com/

  2. From the repository view, create your credentials with name and password enter image description here

  3. Now in the console you can clone your repository by changing the url that azure provides you initialy as

git clone https://<companyname>@dev.azure.com/<companyname>/<project name>/_git/<repository name>

to

git clone https://<your credentials name>@dev.azure.com/<companyname>/<project name/_git/<repository name>

now it will ask you for a password. You must use the one you provided when you created the credentials.

Syriac answered 14/5, 2019 at 15:11 Comment(0)
S
6

The same error (Windows, Git Bash command line). Using https (not ssh) which should prompt for login credentials but instead errors:

$ git pull origin master
fatal: Authentication failed for 'https://github.com/frmbelz/my_git_project.git'
$ git config -l
...
credential.helper=manager
...

$ git config --global --unset credential.helper
$ git config --system --unset credential.helper

git pull now prompted for username/password prompts.

Satsuma answered 8/7, 2021 at 20:40 Comment(1)
For me credential.helper was manager-core, but simply git config --global --unset credential.helper and then reissuing the failed git command helped.Hemia
H
3

A solution I found is to use a personal access token (PAT). It's located in the "clone" tab. It worked very easily.

Hinny answered 23/3, 2019 at 19:0 Comment(0)
N
1

You can reconfigure Git Credential Manager by running:

git credential-manager-core configure

Result:

Configuring component 'Git Credential Manager'...

Configuring component 'Azure Repos provider'...

Nymphet answered 20/4, 2022 at 16:49 Comment(1)
somehow this worked for me.Secundines
R
0

I added sudo to my git push command and i was prompted to enter my github credentials and it worked

sudo git push
Resolve answered 17/7, 2021 at 9:58 Comment(0)
W
0

FWIW, I found that I had to use the Git-Credential-Manager-Core utility:

https://github.com/microsoft/Git-Credential-Manager-Core

Wileywilfong answered 25/10, 2021 at 16:33 Comment(0)
P
-1

Right so my colleague and I were having the same trouble (didn't have this issue on windows, only on mac) and the above solution worked for him and didn't work for me. I had to create a Personal Access Token (PAT) via this guide Authenticate Access With Personal Access Tokens.

Then in iTerm: git clone https://octavialo%40organizationname:[email protected]/organizationname/reponame

%40 is a stand in for the @ sign. I sign in to azure with [email protected]

I also tried with this, where foobar was the name I gave the token: git clone https://foobar:[email protected]/organizationname/

I think the issue could have been with my password which had special characters.

Proscribe answered 11/1, 2019 at 21:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.