简体   繁体   中英

How to enter git credentials on commandline for visualstudio.com?

I try to access my git repository which is hosted on VS Team Services. Works fine in Visual Studio but I need access from the commandline using the standard git client.

When I try to do commands like pull I am asked for my credentials. Now my problem is that my credentials are my MSDN-Account data using my email and a password.

After I entered my email in the git commandline I can see it tries to build a password-url which cannot work because there are two "@"s in the address:

git clone https://myproject.visualstudio.com/DefaultCollection/_git/coderepo
Username for 'https://myproject...':  myself@mydomain.com
Password for 'https://myself@mydomain.com@myproject...' :

After entering my password I receive (not surprisingly) a "fatal: Authentication failed"

So: How do I work with emails as username-credentials in git?

Found a solution myself.

In VS Team Services, under https://[projectname]mydea.visualstudio.com/_details/security/altcreds

there can be entered "Alternate authentication credentials" with a real username (no email)

备用凭据VS Team Services

You can use alternate credentials or personal access token to access to Team Services Hosted Git repositories.

And a more convenient way would be use Git Credential Manager for Windows . This tool will prompt a Team Services sign in dialog when you need to access to Team Services Git Repository and you just need to enter your Team Services account credentials in it directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM