GitError when adding package via LocalRegistry

Hello,

I am using LocalRegistry to maintain a private package. It was working well until today when I recieved an error after trying to add a private package to my project via ] add MyPackage.

Here is the error I received.

(temp) pkg> add MyPackage Resolving package versions... Cloning [info removed] MyPackage from [url removed] ERROR: failed to clone from [url removed], error: GitError(Code:ERROR, Class:OS, failed to parse supported auth schemes: The operation identifier is not valid. ).

I am able to add new versions to the private registry and manually clone the package repo. However, I am not able to add the package via the package system. Any help would be greatly appreciated.

Update

The problem does not appear to be with LocalRegistry, but possible Pkg. Please respond below if you have any potential solutions.

It seems unlikely that the local registry itself is involved in this problem. Does it work to pkg> add with the URL directly? Does it work to clone the package repository outside of Julia?

There’s a fair chance that telling Pkg to use an external git solves the problem.

Thank you for your reply. ] add url_to_package did not work. I am able to clone via git clone url_to_package. Does that mean there is a more general issue with pkg and git permissions?

Thanks for the lead on external git. I will look into that in the meantime.

Can you elaborate on setting an external git? Where do I set JULIA_PKG_USE_CLI_GIT = true?

update

I tried the following


julia> ENV["JULIA_PKG_USE_CLI_GIT"] = true
true

(temp) pkg> add url_to_package
     Cloning git-repo url_to_package
fatal: unable to access 'url_to_package': SSL certificate problem: self signed certificate in certificate chain
ERROR: The command `git clone --quiet url_to_package .julia\clones\5745838388419641502'`, ProcessExited(128))])

Is that the correct usage?

Yes, that ought to work. For alternative methods, do a web search of “set environment variable” and add your operating system.

You are getting a different error now, from trying to run an external git command. Presumably the git clone ... command shown in the error should work if it works externally in a shell, unless there is a shell alias or similar that modifies the call to the git binary.

For further experiments you can cut out Pkg and test directly with

run(`git clone url_to_package`)

Thanks again for your reply. I tried run and received the following error:

julia> run(`git clone url_to_package`)
Cloning into 'mypackage.jl'...
fatal: unable to access 'url_to_package': SSL certificate problem: self signed certificate 
in certificate chain
ERROR: failed process: Process(`git clone url_to_package, ProcessExited(128)) [128]

Yes, that’s consistent with the latest Pkg error. As for why that fails if git clone url_to_package works externally, is a question I can’t answer, although I suspect that when you run git externally it somehow does something more than just calling the git binary.

Thanks for helping troubleshoot. I made a brief update in the initial post in case someone with expertise in this area has an idea for a solution.

I don’t know if the following is informative, but I did find that it works:

run(ssh -T git@_domain_here)

Eventually, I added an access token and enabled 2FA. This actually fixed the problem. I have no idea how these things are supposed to be configured. So I don’t know why it was needed specifically to interact with Julia, but it indeed fixed the problem. Hopefully this saves someone a headache in the future.