New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-6735] github fetch silently stuck waiting for ssh passphrase #4901
Comments
A workaround is to clone the repo outside of the package manager and have the auth cached. |
Comment by Shawn Morel (JIRA) Thanks for the quick update @aciidb0mb3r. I'm curious what the duplicate bug fix was. I couldn't find anything specific other than this old bug If I'm reading the current state of the source code right, I think the bug still exists and is a regression from migrating what used to be the old /Get/Git.swift to the new /Repositories/GitRepository.swift which uses the updated /Basic/Process. By default, Process redirects standard input. If I'm reading Process.swift correctly, this means launch() and waitUntilExit() will consume git's std out into a byte buffer var in the Process instance. While the workaround certainly works, git auth workflows should probably work out of the box given how reliant on git the whole mechanism is. At the very least, it shouldn't just hang silently while the user thinks a fetch is in progress. Sorry if I missed an obvious code fix that happened between now and the 4.0.3 release |
Oh, you're right, the hang issue is different from the auth issue. It is not supposed to hang anymore, I'll look into that. I agree that we need to fix the auth issue but it isn't trivial unfortunately. This is more complicated by the fact that we clone dependencies in parallel now. |
@swift-ci create |
Comment by Shawn Morel (JIRA) Agreed, the “correct” fix is probably quite involved and would make use of something like GIT_ASKPASS or some git credential helper. Given that 1) the std out is redirected and 2) multiple git processes are run concurrently It seems like git should just be told to fail rather than prompt. There’s the little documented GIT_TERMINAL_PROMPT= env var that can be set when exec-ing git. https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials Printing the captured content of stdout is probably still nice to have though after a non-0 process exit code result to help debugging. |
We do set that variable but I think it only works for username/password prompt and not the ssh key password prompt 🙁 |
Comment by Shawn Morel (JIRA) Ah right, my bad, I missed Utilities/Git.enviroment(). There is the new-ish GIT_SSH_COMMAND env var that let's you pass flags to ssh (it takes precedence over the more cumbersome GIT_ SSH). This allows passing flags to ssh. In theory it's only available as of git 2.3 though (default git on macOS 10.13 is 2.14 but somehow GIT_SSH_COMMAND seems to be respected so I'm not sure what fork Apple is using here). References:
Example usage: `$ GIT_SSH_COMMAND="ssh -oBatchMode=yes %@" git pull `$ /usr/bin/git --version $ GIT_SSH_COMMAND="ssh -oBatchMode=yes %@" /usr/bin/git pull Please make sure you have the correct access rights |
Additional Detail from JIRA
md5: ae9984435e20604dff44fd2413be5862
duplicates:
is duplicated by:
Issue Description:
$ swift --version
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Repro steps: Get yourself into a situation where a plain old git-clone would prompt for your ssh key passphrase. I normally have ssh-agent running but it had died.
`swift package update` or `swift package resolve` will silently hang at `Fetching git@github.com:dep-org/Dep.git`
The text was updated successfully, but these errors were encountered: