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://yousefshanawany@dev.azure.com/....

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

Cadoiz
  • 1,446
  • 21
  • 31
AskYous
  • 4,332
  • 9
  • 46
  • 82
  • Please check this link you will get the clear idea about git authentication - https://stackoverflow.com/a/69556615/3660648 – Tejashree Oct 13 '21 at 15:08

8 Answers8

16

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%40email.com@dev.azure.com/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”"

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks. I tried it but received the same response: https://i.imgur.com/BJuumPw.png – AskYous Dec 07 '18 at 17:17
  • @AskYous What does `git remote -v` returns? – VonC Dec 07 '18 at 17:43
  • The URL seems strange: it should be `https://@dev.azure.com//yourRepo`: I am not familiar with the `_git/xxx` part. – VonC Dec 07 '18 at 18:30
  • 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 ''... fatal: repository https://yousefshanawany@dev.azure.com/yousefshanawany//' not found` – AskYous Dec 07 '18 at 20:50
  • @AskYous Is it possible to try with an URL *without* a trailing slash? – VonC Dec 07 '18 at 20:52
  • 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. – AskYous Dec 07 '18 at 21:09
  • @AskYous If it is, don't forget to percent-encode the `@` (`%40`: https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters) – VonC Dec 07 '18 at 21:34
  • solution for IntelliJ Idea - https://stackoverflow.com/a/62518658/7179509 – Maksym Jun 22 '20 at 16:06
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.

Gonzalo Garcia
  • 6,192
  • 2
  • 29
  • 32
5

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.

Vladislav Povorozniuc
  • 2,149
  • 25
  • 26
  • 2
    For me `credential.helper` was `manager-core`, but simply `git config --global --unset credential.helper` and then reissuing the failed git command helped. – White hawk Jan 24 '22 at 08:42
3

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

AskYous
  • 4,332
  • 9
  • 46
  • 82
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'...

asbin
  • 11
  • 2
0

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

sudo git push
Ngodza
  • 387
  • 3
  • 8
0

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

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

Rod
  • 4,107
  • 12
  • 57
  • 81
-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:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/reponame

%40 is a stand in for the @ sign. I sign in to azure with octavialo@organizationname.com

I also tried with this, where foobar was the name I gave the token: git clone https://foobar:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/

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

OctaviaLo
  • 1,268
  • 2
  • 21
  • 46