Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 445
IBlackVikingl Avatar asked Feb 01 '26 16:02

IBlackVikingl


2 Answers

git config credential.helper store

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

like image 113
Ziming Song Avatar answered Feb 04 '26 04:02

Ziming Song


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).

like image 26
VonC Avatar answered Feb 04 '26 06:02

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!