# Automate Git credentials for package updates

**URL:** <https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607>\
**Category:** General Usage\
**Created:** [February 13, 2020, 10:58pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607 "2020-02-13T22:58:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adriel](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adriel](https://discourse.julialang.org/u/Adriel)\
**Post date:** [February 13, 2020, 10:58pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/1 "2020-02-13T22:58:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 14, 2020, 8:36am UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/2 "2020-02-14T08:36:24Z")

</div>

Just use SSH keys:

> **[Use SSH keys to communicate with GitLab | GitLab](https://docs.gitlab.com/ee/user/ssh.html)**
>
> Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Rollen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_rollen/32/7498_2.png) [@Sebastian\_Rollen](https://discourse.julialang.org/u/Sebastian_Rollen)\
**Post date:** [May 1, 2020, 10:40pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/3 "2020-05-01T22:40:36Z")

</div>

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

```julia
[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

---

<div class="post-metadata">

**Author:** ![jsbryan4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jsbryan4/32/34173_2.png) [@jsbryan4](https://discourse.julialang.org/u/jsbryan4)\
**Post date:** [August 16, 2022, 5:52pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/4 "2022-08-16T17:52:10Z")

</div>

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?

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

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 16, 2022, 8:36pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/5 "2022-08-16T20:36:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsbryan4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jsbryan4/32/34173_2.png) [@jsbryan4](https://discourse.julialang.org/u/jsbryan4)\
**Post date:** [August 16, 2022, 8:54pm UTC](https://discourse.julialang.org/t/automate-git-credentials-for-package-updates/34607/6 "2022-08-16T20:54:30Z")

</div>

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