简体   繁体   中英

VS Code: Pushing and pulling always ask for password

I'm using git in VS Code. I have a project in Azure DevOps. 3 months ago when I copied repo and pushed my first commit Git asked for my credentials. I entered username and generated password. After that everything was working fine. Starting march every time I pull or push VS Code askes for password. How can I save my password?

git config credential.helper store

Then git will remember your credential locally. That config is also local.

Check first what URL you are using:

cd /path/to/local/repo
git remote -v

If it is an HTTPS URL, check what credential helper you are using

git config credential.helper
xxx

(For instance, manager or manager-core )

Then check what credential is attached to dev.azure.com , the server part of your remote URL:

printf "host=dev.azure.com\nprotocol=https" | git credential-xxx get

Replace xxx with the name of the credential helper for the previous step.

This work even in a Windows CMD, provided your %PATH% has C:\Program Files\Git\usr\bin and C:\Program Files\Git\mingw64\libexec\git-core

If your credential is not stored, you can register it again with git credential-xxx store :

printf "username=<you>\npassword=<token>\nhost=dev.azure.com\nprotocol=https" | git credential-xxx store

Replace <you> with your DevOps username, and <token> with an Azure PAT (Personal Access token) .

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