I'm new to using Gitlab. My workplace has recently moved from on-prem Git to a cloud-based Gitlab host. I used ssh authentication in the past with our on-prem so never had to deal with credentials hanging around (I'm using Linux) in .git/config
or ~/.gitconfig
.
If I let git
manage my credentials/tokens, with whatever defaults it uses, those creds/tokens end up stored in plaintext in my home directory under ~/.git-credentials
or in the .git/config
file, which is problematic for various reasons.
I poked around and found Git Credential Manager Core but after getting it installed, as shown in the README, I'm not exactly sure it's working correctly, or I'm misunderstanding how to use it. I ran these commands to get it setup:
dpkg -i gcm-linux_amd64.2.0.785.deb
git-credential-manager-core configure
git config --global credential.credentialStore gpg
pass init <gpg-id>
I tried cloning a cloud-based repo using a personal access token, but when I clone it, gpg
prompts me for my passphrase, but the token ends up in the .git/config file
anyway.
$ git clone https://user-test-token:[email protected]/my.username/my-repo.git
$ cat .git/config
...
[remote "origin"]
url = https://user-test-token:[email protected]/my.username/my-repo.git
...
What am I doing wrong?
credential.helper
is going to store things in the clear (as far as I can tell). Also, some of those posts mention just put your credentials in the URL which also gets saved in.git/config
in cleartext also. – Homophonic