5

I'm trying to push a branch (git push <remote> master) to my remote repository. When I'm doing it from cmd, I'm prompted with my user name and password:

Username for 'https://<my_domain>.visualstudio.com': <my_user_name>

Password for 'https://<my_user_name>@<my_domain>.visualstudio.com':

and after typing it I get:

fatal: Authentication failed for https://<my_domain>.visualstudio.com/<my_repo>'

However when I do the same thing from git bash it just works, without prompting the username and password.

I checked the user name and password in the repository at visual studio team services where the repository hosted, and it seems like working.

Checking git config user.name and git config user.password from git bash yielded exactly the username and password that I'm typing in cmd.

Does anyone know what am I doing wrong with the authentication, and how can I configure git to connect correctly from cmd?

I looked through similar questions on the site, but didn't find anything that works.. Thanks!

2 Answers 2

10

git config --global credential.helper manager solved the problem

Sign up to request clarification or add additional context in comments.

Comments

0

I faced a similar issue where git clone was failing with the same error of:

fatal: Authentication failed for 'https://somename.visualstudio.com

In Azure DevOps, I went to the repository and clicked on clone. Just below the command line information there is a "Generate Git Credentials" button. If you click on this, this will generate a token which can be used as password.

When the login window appears when you try git clone, you have to enter your username and the generated token as the password, this helped solve the issue in my case.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.