Local Registry RSA key Problem

@GunnarFarneback, I cannot thank you more about the deep dive on this issue. I was recently trying to perform Git tasks using LibGit2 as described here, and your thorough analysis on the issue was crucial in finding a solution. For other people, here is the set up that worked for me to use LibGit2.

(1) Create the SSH private–public key pair of type ECDSA by

ssh-keygen -t ecdsa -C "<your email address>"

This generates id_ecdsa (private key) and id_ecdsa.pub (public key) in $HOME/.ssh/ directory.

(2) Let Julia know about the location of the created private and public keys by adding the following lines in $HOME/.julia/config/startup.jl:

ENV["SSH_PUB_KEY_PATH"] = joinpath(homedir(), ".ssh", "id_ecdsa.pub")
ENV["SSH_KEY_PATH"] = joinpath(homedir(), ".ssh", "id_ecdsa")

(3) Add the Git hosting service (like the public GitHub or your organization’s internal GitHub Enterprise) to $HOME/.ssh/known_hosts. For example, for the public GitHub, this can be done by

ssh-keyscan www.github.com >> $HOME/.ssh/known_hosts

After (1)–(3), I didn’t have to put

ENV["JULIA_PKG_USE_CLI_GIT"] = true

in $HOME/.julia/config/startup.jl anymore, because this line was needed for using the command-line Git rather than LibGit2. I think I initially put this line in order to use the package manager in the situation where LibGit2 didn’t work, but now I wanted to use LibGit2 outside the package manager, for which the line didn’t help.

I note that the setup described here would work only for Julia version ≥ 1.8, which uses libssh2 that supports ECDSA-type keys as pointed out in Item 5 of @GunnarFarneback’s analysis above.

2 Likes