If I set
git config --global credential.username my_username
option, then overwriting it for one repository with --local
option gives no difference for it - it still uses global credentials while trying to commit or push. How can I change this?
You can check the credentials stored in the file ~/. git-credentials . For more information, visit git-credential-store - Helper to store credentials on disk.
The repo local config doesn't work for me. After trying all kinds of ways from stackoverflow, finally it works by switching from ssh to https and using credential.helper :
step 1, change git remote from ssh to https:
$ git remote -v
[email protected]:#####/###.git (push)
$ git remote rm origin
$ git remote add origin https://[email protected]/######/###.git
step 2, let credential.helper to help remember password to avoid annoying repeat asking.
$ git config --global credential.helper cache
$ git config --global credential.helper 'cache --timeout 7200'
By default credentials will be saved in ~/.git-credentials. It will be created and written to.
But please note using this helper will store your passwords unencrypted on disk, protected only by filesystem permissions. If this may not be an acceptable security tradeoff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With