# GitError when adding package via LocalRegistry

**URL:** <https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125>\
**Category:** General Usage\
**Tags:** question, pkg, registry\
**Created:** [March 4, 2024, 11:23am UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125 "2024-03-04T11:23:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 11:23am UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/1 "2024-03-04T11:23:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 4, 2024, 11:37am UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/2 "2024-03-04T11:37:55Z")

</div>

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](https://github.com/GunnarFarneback/LocalRegistry.jl/blob/master/docs/ssh_keys.md#2-using-an-external-git-binary-with-julias-package-manager) solves the problem.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 11:43am UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/3 "2024-03-04T11:43:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 11:49am UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/4 "2024-03-04T11:49:22Z")

</div>

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

**update**

I tried the following

```julia

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?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 4, 2024, 12:29pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/5 "2024-03-04T12:29:09Z")

</div>

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

```julia
run(`git clone url_to_package`)

```

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 12:36pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/6 "2024-03-04T12:36:17Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 4, 2024, 12:50pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/7 "2024-03-04T12:50:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 12:54pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/8 "2024-03-04T12:54:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 4:12pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/9 "2024-03-04T16:12:54Z")

</div>

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

`run(`ssh -T git@\_domain\_here`)`

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [March 4, 2024, 5:13pm UTC](https://discourse.julialang.org/t/giterror-when-adding-package-via-localregistry/111125/10 "2024-03-04T17:13:08Z")

</div>

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.
