On a fresh Windows 11 machine I’m trying to add private package (or private registry) via SSH and found that vscode terminal works differently from external Julia terminal.
I followed instructions from LocalRegistry.jl .
Generated and added SSH key to github account :
ssh-keygen -t rsa -b 4096 -m PEM
Added the following line in ~/.julia/config/startup.jl
ENV["JULIA_PKG_USE_CLI_GIT"]=true
In external Julia console (started from Git Bash or Powershell) I can add private package:
(test_julia_env) pkg> add git@github.com:sairus7/MyPrivatePackage.jl.git
Cloning git-repo `git@github.com:sairus7/MyPrivatePackage.jl.git`
Updating git-repo `git@github.com:sairus7/MyPrivatePackage.jl.git`
Resolving package versions...
But in vscode console (started from command pallete: F1 - Julia: Start REPL) I have an error:
(test_julia_env) pkg> add git@github.com:sairus7/MyPrivatePackage.jl.git
Updating git-repo `git@github.com:sairus7/MyPrivatePackage.jl.git`
ERROR: The command `git fetch -q git@github.com:sairus7/MyPrivatePackage.jl.git '+refs/*:refs/remotes/cache/*'` failed, error: Base.IOError("could not spawn `git fetch -q git@github.com:sairus7/MyPrivatePackage.jl.git '+refs/*:refs/remotes/cache/*'`: no such file or directory (ENOENT)", -4058)
Are there any vscode-specific settings that change git cli behaviour? Or should I add JULIA_PKG_USE_CLI_GIT somewhere else in vscode settings?
UPD:
However, some time ago I had no problems with JULIA_PKG_USE_CLI_GIT
from vscode, so maybe there are some changes with git behaviour? Forcing git to use system-wide OenSSH didn’t help:
git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"
For now it works in both consoles only if I remove JULIA_PKG_USE_CLI_GIT and add the following lines in ~/.julia/config/startup.jl
:
ENV["SSH_PUB_KEY_PATH"] = joinpath(homedir(), ".ssh", "id_rsa.pub")
ENV["SSH_KEY_PATH"] = joinpath(homedir(), ".ssh", "id_rsa")