Can't add package from git - authentication failure

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

I am trying to add a package from git

(@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 :frowning:

I tried

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

Try Pkg.deving the local path instead.

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

Thank you for the suggestion, but

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

and

(@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

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?

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.

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.

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 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.

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

1 Like

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)

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.

Just to elaborate, with a private repo you need to create a token on Github as described here, 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).

1 Like