sheldon icon indicating copy to clipboard operation
sheldon copied to clipboard

sheldon lock --update fails if github is configured to use ssh

Open lburgazzoli opened this issue 4 years ago • 2 comments

My plugin setup is as follow:

shell = "zsh"
apply = ["defer"]

[templates]
defer = { value = 'zsh-defer source "{{ file }}"', each = true }

[plugins]

[plugins.zsh-defer]
github = "romkatv/zsh-defer"
apply = ["source"]

[plugins.zsh-syntax-highlighting]
github = "zsh-users/zsh-syntax-highlighting"
use = ["{{ name }}.zsh"]

When I run sheldon lock --update, the process ends after a long time with the following error:

error: failed to install source `https://github.com/romkatv/zsh-defer`
  due to: failed to git fetch
  due to: Failed to retrieve list of SSH authentication methods: Failed getting response; class=Ssh (23); code=Auth (-16)

error: failed to install source `https://github.com/zsh-users/zsh-syntax-highlighting`
  due to: failed to git fetch
  due to: Failed to retrieve list of SSH authentication methods: Failed getting response; class=Ssh (23); code=Auth (-16)

This seems to be caused by the fact that in my git configuration, I always use ssh to access git repos:

[url "[email protected]:"]
    insteadOf = https://github.com

If I remove the mapping above, then the command succeed.

lburgazzoli avatar Dec 11 '21 11:12 lburgazzoli

@lburgazzoli are you using an ssh-agent? Currently sheldon only supports authentication over ssh when there is an ssh-agent present. As far as I understand SSH with github always requires authentication even just to clone a public repository.

rossmacarthur avatar Dec 13 '21 11:12 rossmacarthur

Yes I have the ssh-agent running (on OSX)

➜ ps -ef | grep ssh-agent
  501  1944     1   0 Tue06PM ??         0:03.39 /usr/bin/ssh-agent -l

My ssh config is like:

Host github.com
    HostName ssh.github.com
    Port 443
    User lburgazzoli
    IdentityFile ~/.ssh/github

lburgazzoli avatar Dec 13 '21 12:12 lburgazzoli

Just saw this - you need the ssh agent env vars on any shell that you run, so it makes sense to eval $(ssh-agent) before sheldon, other wise it won't be able to find the agent.

Also on macOS I do this:

Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519```

tyronick avatar Oct 10 '22 00:10 tyronick

@tyronick o great, that works !

lburgazzoli avatar Oct 10 '22 07:10 lburgazzoli