Open lapfelix opened 2 months ago
@lapfelix Being relatively unfamiliar with this portion of the codebase, does libssh2 not support accessing passphrased sah keys?
hmm it would definitely be possible to support passphrased ssh keys, and GitUp could save the passphrase in the keychain.
(In theory though the ssh agent should "just work" but in practice, I'm not sure why it's not super reliable and why it sometimes needs to be kickstarted after a reboot)
I guess I'm trying to figure out what this particular PR is trying to improve. Wouldn't this environment variable be set as long as ssh-agent was running? Is this just meant to short circuit the case where it isn't?
Yes basically I didn't find any straightforward way to retry calling the _CredentialsCallback
, but if the ssh-agent
isn't running, the environment variable won't be set, so we don't even need to try the ssh-agent
, we know it'll fail.
This PR helps cases where the ssh agent isn't running, but maybe there's a more "correct" solution to the problem. Like I wonder when line 455 ever executed, for instance
For some reason I seem to be failing in testClone
with or without this change on the SSH clone GCSingleCommitRepositoryTests:173
and I'm trying to figure out why but I assume it's related to what you were trying to fix here. I know these tests were all passing previously, not sure if macOS version changed something here but if you know how to get them passing, I'd be happy to hear it.
Really should setup Xcode Cloud after this to have some easy CI wins.
It seems that when running tests, the SSH_AUTH_SOCK
env variable is not defined; whereas when running the app target, the variable does have a value (something like /private/tmp/com.apple.launchd.A4ChBGpp47/Listeners
). I think that's what preventing libgit2 from cloning the repo.
But, why does that difference exist? I'm not familiar with how Xcode runs things enough, and looking at the schemes, I didn't find anything obvious that'd explain the difference.
Ya it's strange as I know this passed previously without change to this. And yes cloning this repo via SSH in app does work.
Fixes the cloning test through ssh (
GCSingleCommitRepositoryTests
'stestClone
) on computers that don't have a correctly setup ssh agent, like mine 🥴 (as the keys in~/.ssh
will be used instead, and that's going to work as long as they're not protected by a passphrase).If
SSH_AUTH_SOCK
isn't there, it will fail later on anyway when libgit2 uses libssh2.Should also make ssh agent workarounds like this one unnecessary: https://github.com/git-up/GitUp/issues/161#issuecomment-643863909
I AGREE TO THE GITUP CONTRIBUTOR LICENSE AGREEMENT