Ebeid ElSayed
Ebeid ElSayed

Reputation: 1156

Failed to push to Azure DevOps git repo - it didn't ask for username

I'm trying the new Azure DevOps offering from Microsoft. My account is through my school (GeorgiaTech). I used an open source project for that (dcm4che). I had cloned the dcm4che repo from GitHub locally. Now trying to push it to Azure DevOps

➜  dcm4che git:(master) git remote add azure https://[email protected]/OHIF/dcm4che/_git/dcm4che
➜  dcm4che git:(master) git push -u azure --all
Password for 'https://[email protected]':
fatal: Authentication failed for 'https://[email protected]/OHIF/dcm4che/_git/dcm4che/'

surprisingly Azure didn't ask me for username. I don't know what should I do to provide username

Upvotes: 3

Views: 9470

Answers (6)

Angel Angeles
Angel Angeles

Reputation: 111

In my case I used the Visual Studio Code GUI to set the password again:

how to do a fetch on VSCode

After click fetch git asked me the password to continue the process and there it worked!

Upvotes: 0

JM Tee
JM Tee

Reputation: 121

***Applicable if you are using Command line or Bash*

Typically, after git clone <url of repo> a pop-out screen would appear and let you login in your Microsoft Account.

However, some older versions of Git (e.g 2.17) doesn't show the pop-up for some reason but asks for a password.

First Solution: Just update your git to the latest version.

Second Solution But if you are in a restricted device (no admin rights etc) then this is the 2nd option: 1. Login to Azure Devops account, click on your Avatar then on "Security" enter image description here

  1. Create a new Personal Token having these parameters. enter image description here

  2. Copy the token somewhere and use this token as your password when you do git commands. enter image description here

Upvotes: 1

Lapenkov Vladimir
Lapenkov Vladimir

Reputation: 3218

Only if u're using Visual studio 2017. This bug got fixed after i updated VS to 15.9.4. Things got to work though i have git version 2.17

Upvotes: 0

jamill
jamill

Reputation: 1732

This is an issue with older versions of the Git Credential Manager that is included with Git For Windows and the new style that URLs that Azure DevOps uses. The new style URLs are those that start with https://dev.azure.com/. You shouldn't need to include a username.

I would recommend you update to the latest version of Git for Windows, which includes the latest Git Credential Manager, if possible. It can be downloaded from: https://git-scm.com/downloads. I believe the Git for Windows v2.19.0 or later includes a version of Git Credential Manager that works with these URLs.

Upvotes: 1

Migg
Migg

Reputation: 484

This is a known issue with git-credential manager (bug report)

Quickest way to address this is to change the URL from

https://[email protected]/MY_USER/PROJECT/_git/REPOSITORY

into

https://MY_USER@MY_USER.visualstudio.com/PROJECT/_git/REPOSITORY

Upvotes: 0

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41565

Is not asking for username because in the git remote add you put the username before the repo URL: https://[email protected] - the OHIF@ before the URL tell git that you want to use the OHIF username and he asking password for this username.

Try this: git remote add azure https://dev.azure.com/OHIF/dcm4che/_git

Upvotes: 3

Related Questions