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.