Pkg.jl: Dev'ing private GitHub repo in Julia v1.3 keeps asking for ssh key

Created on 30 Nov 2019  路  6Comments  路  Source: JuliaLang/Pkg.jl

I've created a private repo on GitHub and tried dev'ing it with the usual ] dev repo-url command. The package manager kept asking me for my private ssh key even after providing the path multiple times. I can confirm that git clone repo-url outside Julia works just fine. The problem started with Julia v1.3, or at least I noticed it now after the upgrade. Can you reproduce?

Most helpful comment

If your ssh-keygen is version 7.8 or later you also need to add -m PEM. See https://github.com/JuliaLang/Pkg.jl/issues/911#issuecomment-640399940.

All 6 comments

I didn't expect to but actually I can reproduce on one computer (recent version of Debian) but not on another (Ubuntu 18.04). It's not specific to Julia 1.3 for me though. I'll see if I can simulate the server end so I can debug the ssh communication.

When I try to simulate the server (a bare repo on a local computer, accessed by ssh) I can't reproduce the problem. (Both computers can successfully develop the package.) Unfortunately that makes debugging harder. If someone has an idea how to debug, please tell.

It looks like libssh2 can be configured to enable traces, https://www.libssh2.org/libssh2_trace.html. Probably need to build it myself first.

It turned out that my problem was that I had both a dsa and an rsa key on that computer, and only the dsa key was registered with github. libssh2 tried to use the rsa key (and couldn't use the dsa key when pointed to it) whereas command line git used the normal ssh client which presumably tried both keys and found one that worked.

This specific scenario is probably not too common but I'm sure there are all sorts of ssh configurations that libssh2 doesn't know how to handle even though the ssh client does.The repeated question for the ssh key doesn't mean that it failed to find the key, by the way, only that something went wrong in the authentication.

To debug I did the following:

  1. Installed the libmbedtls-dev Debian package.
  2. Downloaded the libssh2 source code from https://www.libssh2.org/download/libssh2-1.9.0.tar.gz and unpacked it.
  3. In src/misc.c, line 452, patched out the if(!(session->showmask & context)) test.
  4. 4.
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON -DENABLE_DEBUG_LOGGING=ON ..
make
  1. Copied the built libssh2.so.1.0.1 (from build/src) into Julia's lib/julia directory on top of the existing library with the same name.
  2. Started Julia and tried to dev my github URL. The debug output appeared on stderr and finished, before asking for the ssh key location, with:
[libssh2] 0.957984 Failure Event: -18 - Username/PublicKey combination invalid

I've bumped into this issue and generating ssh-key with rsa encryption solved this.
https://discourse.julialang.org/t/accesing-a-registry-on-private-github/19997/16

ssh-keygen -f "$HOME/.ssh/id_rsa" -t rsa -b 1024 -N password

If I creat ssh key with ecdsa encryption, Julia keeps asking for ssh password

ssh-keygen -f "$HOME/.ssh/id_rsa" -t ecdsa -b 521 -N password

If your ssh-keygen is version 7.8 or later you also need to add -m PEM. See https://github.com/JuliaLang/Pkg.jl/issues/911#issuecomment-640399940.

Was this page helpful?
0 / 5 - 0 ratings