I wanted to store my credentials "safely" for use by git
so I did as instructed
here. This way I don't have to input password/PAT every single time, I perform any git operation.
Install libsecret
using sudo apt-get install libsecret-1-0 libsecret-1-dev
Build the "credential manager" using sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
and then configure my local git folder using git config --global credential.helper \ /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
Works superb.
What I don't get is how to do the same for many passwords associated with different accounts/repositories. I was suggested to use gcm core.
I tried installing gcm core
as instructed here.
Download .deb package
sudo dpkg -i <path-to-package> git-credential-manager-core configure
configure the "credential store" git config credential.credentialStore secretservice
(as I use libsecret).
I removed the Credential helper
pointing to
/usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
from the local git config file.
It still doesn't work. When I try to push a repo, I get a garbled
message with how to use git config
followed by request to fill in
credentials (shown here). I don't understand what I am doing! namely credential store
, credential manager
, secret-service
and gcm core
.
Any credential helper should follow the same process.
But if you have multiple account/password for the same domain (say github.com for instance), then you need to change your remote URL
cd /path/to/my/local/repo1
git remote set-url origin https://user1@github.com/user1/myRepo1
^^^^^^
cd /path/to/my/local/repo2
git remote set-url origin https://user2@github.com/user1/myRepo2
^^^^^^
That way, the credential helper will differentiate your different account.
Since gcm core is a bit fineky to install, test it first with the classic libsecret-based helper.