# Basic introduction to ssh-agent, libGit2 in the context of Pkg

**URL:** <https://discourse.julialang.org/t/basic-introduction-to-ssh-agent-libgit2-in-the-context-of-pkg/50113>\
**Category:** New to Julia\
**Tags:** question, pkg\
**Created:** [November 13, 2020, 8:49pm UTC](https://discourse.julialang.org/t/basic-introduction-to-ssh-agent-libgit2-in-the-context-of-pkg/50113 "2020-11-13T20:49:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [November 13, 2020, 8:49pm UTC](https://discourse.julialang.org/t/basic-introduction-to-ssh-agent-libgit2-in-the-context-of-pkg/50113/1 "2020-11-13T20:49:51Z")

</div>

[This thread](https://discourse.julialang.org/t/pkg-clone-keeps-asking-for-my-ssh-key/15155) ([and this](https://github.com/JuliaLang/Pkg.jl/issues/911), [and this](https://github.com/JuliaLang/julia/issues/10892), [and this](https://discourse.julialang.org/t/what-should-i-do-when-asked-for-a-private-key-loaction-when-adding-a-private-repository-on-windows/29201)) discuss a situation where something called “ssh-agent” is involved in preventing Pkg.add() from repeatedly requesting to override the private key location (when the existing one is actually valid), and ultimately failing:

```julia
julia> Pkg.add(url="git@github.com:me/myrepo.jl.git")
    Cloning git-repo `git@github.com:me/myrepo.jl.git`
Private key location for 'git@github.com' [/home/me/.ssh/id_rsa]: 
Private key location for 'git@github.com' [/home/me/.ssh/id_rsa]: 
Private key location for 'git@github.com' [/home/me/.ssh/id_rsa]: 
ERROR: failed to clone from git@github.com:me/myrepo.jl.git, error: GitError(Code:EAUTH, Class:Callback, Aborting, maximum number of prompts reached.)
Stacktrace:
 [1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:52
...

```

The above happens despite the fact that on the same machine the following command always works:

```julia
$git clone git@github.com:me/myrepo.jl.git

```

The solution in the post linked above, which I don’t completely understand seems like it might be suggesting [manually copying credentials](https://discourse.julialang.org/t/pkg-clone-keeps-asking-for-my-ssh-key/15155/6) to a place where something called “[LibGit2](https://docs.julialang.org/en/v1/stdlib/LibGit2/#LibGit2)” can read them?

I tried the accepted solution in that thread and it failed:

```julia
$ ~/.ssh % eval $(ssh-agent) > /dev/null
bash: /home/me/.ssh: Is a directory

```

Perhaps most confusingly, this is not a process that is always needed, presumably because the credentials-wrangling is baked in to some other utility that has previously executed the necessary steps in an unsupervised manner. For instance, right now I only get this error on my lab workstation, which is running Ubuntu 18.04, but not on my laptop, which is running Ubuntu 20.04. And I’m reasonably sure I never knowingly executed any of these commands on my laptop.

I think it’s admirable that the julia community is such a polite, knowledgeable and generally benevolent group. The documentation itself has perhaps the [most thoughtful collection of design-related help](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-tips) for non-compiler experts I’ve ever seen anywhere. Why can’t a basic introduction to libGit2 and the user-level steps necessary to ensure proper functionality for Pkg (eg through ssh-agent) be added to the manual as well?

The primary reasoning behind this omission is presumably that private repos are not of general interest. But there are lots of reasons to have a private repo: for convenience a wip implementation may include credentials or proprietary information, test coverage needs improvement, unfinished personal stuff I’m just messing around with, advisor not cool with public unpublished, etc.

---

<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:** [November 13, 2020, 9:15pm UTC](https://discourse.julialang.org/t/basic-introduction-to-ssh-agent-libgit2-in-the-context-of-pkg/50113/2 "2020-11-13T21:15:40Z")

</div>

> [@mkarikom](#):
>
> The primary reasoning behind this omission is presumably that private repos are not of general interest. But there are lots of reasons to have a private repo: for convenience a wip implementation may include credentials or proprietary information, test coverage needs improvement, unfinished personal stuff I’m just messing around with, advisor not cool with public unpublished, etc.

I would venture the guess that the main reason is that there is a shortage of people with sufficient skills in ssh authentication technology and a need to get it to work with Julia packages.

> [@mkarikom](#):
>
> Why can’t a basic introduction to libGit2 and the user-level steps necessary to ensure proper functionality for Pkg (eg through ssh-agent) be added to the manual as well?

I’m confident that whenever someone volunteers such a write-up, it will quickly get included.

---

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [November 15, 2020, 12:50am UTC](https://discourse.julialang.org/t/basic-introduction-to-ssh-agent-libgit2-in-the-context-of-pkg/50113/4 "2020-11-15T00:50:49Z")

</div>

I’d like to walk back my original complaints in recognition of the fact that [articles in the manual](https://docs.julialang.org/en/v1/manual/modules/#modules) and articles in this forum serve different and complementary roles in documentation.

Thus, I threw up a [post with a few simple steps](https://discourse.julialang.org/t/2-step-guide-for-github-repos-with-pkg/50166) that should work for 90% of people running linux.
