Reputation: 1519
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!
Upvotes: 5
Views: 18727
Reputation: 606
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.
Upvotes: 0
Reputation: 1519
git config --global credential.helper manager
solved the problem
Upvotes: 9