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

This thread (and this, and this, and this) 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> 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:

$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 to a place where something called “LibGit2” can read them?

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

$ ~/.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 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.

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.

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

3 Likes

I’d like to walk back my original complaints in recognition of the fact that articles in the manual and articles in this forum serve different and complementary roles in documentation.

Thus, I threw up a post with a few simple steps that should work for 90% of people running linux.