# Can't add package from git - authentication failure

**URL:** <https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 18, 2022, 11:17am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078 "2022-03-18T11:17:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [March 18, 2022, 11:17am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/1 "2022-03-18T11:17:02Z")

</div>

Hi. I am having trouble doing something which I have done easily in the past.

I am trying to add a package from git

```julia
(@v1.7) pkg> add https://github.com/msimms/LibIsolationForest.jl.git
     Cloning git-repo `https://github.com/msimms/LibIsolationForest.jl.git`
Username for 'https://github.com':<my username>
Password for 'https://<my username>@github.com': 

```

I give it the correct credentials but it ignores them and keeps asking me again.

I can log into github fine with those same credentials

Maybe there is some detail I have forgotten and am doing wrong?  
[or perhaps I have a github issue? Is there a way I can check?]

Thanks for any help

PS I am able to download/unzip the repo to a local directory, but cannot seem to add the package locally, either ☹

I tried

```julia
Pkg.add(path="/Users/<my_homedir>/Downloads/LibIsolationForest-master/")
ERROR: Did not find a git repository at `/Users/<my_homedir>/Downloads/LibIsolationForest-master/`

```

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 18, 2022, 11:48am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/2 "2022-03-18T11:48:56Z")

</div>

Try `Pkg.dev`ing the local path instead.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 18, 2022, 11:57am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/3 "2022-03-18T11:57:44Z")

</div>

Can it have to do with github not allowing password authentication in the same way anymore?

> **[Git password authentication is shutting down](https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/)**
>
> Git password authentication is shutting down

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [March 18, 2022, 11:59am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/4 "2022-03-18T11:59:35Z")

</div>

Thank you for the suggestion, but

```julia
julia> Pkg.dev(file="/Users/<my_homedir>/Downloads/LibIsolationForest-master")
ERROR: UndefVarError: dev not defined

```

and

```julia
(@v1.7) pkg> dev /Users/<my_homedir>/Downloads/LibIsolationForest-master
ERROR: could not find project file in package at `/Users/<my_homedir>/Downloads/LibIsolationForest-master` maybe `subdir` needs to be specified

```

Thanks

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 18, 2022, 12:02pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/5 "2022-03-18T12:02:26Z")

</div>

The method is `Pkg.develop(path="...")`, and the second error seems to say you don’t have a proper package structure for a julia package. Do you have a `Project.toml` in that folder?

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [March 18, 2022, 12:05pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/6 "2022-03-18T12:05:37Z")

</div>

> [@albheim](#):
>
> Can it have to do with github not allowing password authentication in the same way anymore?
> 
> [Git password authentication is shutting down - The GitHub Blog](https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/)

Thank you, this seems to be relevant. I read that post, but didn’t understand what I need to do to be able to add non-registry packages [they give complicated instructions for developers, etc., but I’m just a lowly user]

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [March 18, 2022, 12:11pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/7 "2022-03-18T12:11:52Z")

</div>

> [@albheim](#):
>
> The method is `Pkg.develop(path="...")` , and the second error seems to say you don’t have a proper package structure for a julia package. Do you have a `Project.toml` in that folder?

Thanks, you are right, I didn’t notice but that is missing. I was able to run include() OK on the file. I’ll see if that is good enough.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 20, 2022, 9:26pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/8 "2022-03-20T21:26:49Z")

</div>

It means that since this is a private repository you need to authenticate to be able to clone it, but authentication with username and password is not accepted anymore by [github.com](http://github.com) for these kinds of operations.  
So you would need to set up some other means of authentication, an ssh key is a good alternative so i would recommend looking into that. Search for “ssh key github” or something similar and you should find instructions.

---

<div class="post-metadata">

**Author:** ![guilhermebodin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guilhermebodin/32/6982_2.png) [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Post date:** [March 21, 2022, 3:50am UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/9 "2022-03-21T03:50:01Z")

</div>

This issue might have some suggestions of workarounds [https://github.com/JuliaLang/Pkg.jl/issues/3030](https://github.com/JuliaLang/Pkg.jl/issues/3030)

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [April 1, 2022, 4:17pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/10 "2022-04-01T16:17:10Z")

</div>

Thanks All! No Easy fix here, it seems, other than zipping up everything, downloading it, and installing locally (which seems to work but is clunky)

---

<div class="post-metadata">

**Author:** ![hdavid16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hdavid16/32/11531_2.png) [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Post date:** [May 27, 2022, 1:10pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/11 "2022-05-27T13:10:40Z")

</div>

I was able to get it to work on a Linux server over ssh:

1. pkg\> add 
2. Had to authorize credentials twice (using my Personal Access Token in place of my GitHub password)
3. pkg\> dev 
4. Authorize once using GitHub username and Personal Access Token

Done.

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [May 27, 2022, 1:32pm UTC](https://discourse.julialang.org/t/cant-add-package-from-git-authentication-failure/78078/12 "2022-05-27T13:32:32Z")

</div>

Just to elaborate, with a private repo you need to create a token on Github as described [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token), and then use it as your password. Make sure to copy and save the token somewhere when it is first created, like a password manager, as I don’t think there is any way to ever see it again on Github (i.e. you can delete it but not view it).
