Automate Git credentials for package updates

I have several of my own packages stored on a campus GitLab server.

Every time I do a Pkg.update(), I have to provide my Git username/password, individually for each of these packages. It gets a bit tedious.

Is there a way to store Git credentials somewhere so Pkg can provide them automatically?

2 Likes

Just use SSH keys:

3 Likes

You can store the credentials in ~/.git-credentials as https://{user}:{password}@github.com and then add

[credential]
    helper = store

to your ~/.gitconfig

EDIT:
I see you asked about gitlab and not github, my bad. I think the above solution should still work if you change github to gitlab, but I don’t know for sure

1 Like

When you say

You can store the credentials in ~/.git-credentials as https://{user}:{password}@github.com and then add

what do you mean? For example if my username is “user1” and my password (or 2fa token) is “12345”, What do I write in my .git-credentials file? is it this?

[user]
    name = Bob
    email = bob@email.com
[github]
    user = user1
    password = 12345
[credentials]
    helper = store

I think it would be https:/user1:12345@github.com.

1 Like

I see, .git-credentials is its own file with just https:/user1:12345@github.com in it. Thanks!