{{ message }}
Add OpenSSH support#6617
Merged
Merged
Conversation
Member
Author
|
Neat, thanks for trying this out. Can you get a core or stack trace? |
|
Valgrind: |
|
Commenting out the |
Member
Author
|
Oops, that's definitely a mistake. It looks like I haven't built that branch without any SSH support in a while. Thanks for catching that. You'll need to configure libgit2 with |
|
I had to do this to get it working: bergkvist/git2-rs@9a4d232 (git2-rs doesn't use cmake) I would love for this to get merged into libgit2. |
Member
Author
We may want to support SSH but with a different provider that is not libssh2. Add GIT_SSH to indicate that we have some inbuilt SSH support and GIT_SSH_LIBSSH2 to indicate that support is via libssh2. This is similar to how we support GIT_HTTPS and GIT_OPENSSL, for example.
We can now use the `git_process` class to invoke OpenSSH and use it as an SSH transport. This may be preferred over libssh2 for a variety of callers.
We can't reliably detect SIGPIPE on close because of platform differences. Track `pid` and send `SIGTERM` to a function and ensure that we can detect it.
There are no custom callbacks for OpenSSH; don't test them.
Now that we (may) exec a child process to do ssh, we don't want valgrind reporting on that. Suppress children in valgrind runs.
A transport may want to validate that it's in a sane state; when flushing on close, don't assume that we're doing an upload-pack; send the correct direction.
Instead of "early EOF", provide information on _when_ we're seeing the EOF for debugging.
Suppress SIGPIPEs during writes to our piped process. On single-threaded applications, this is as simple as ignoring the signal. But since this is process-wide, on multi-threaded applications, we need to use some cumbersome `pthread_sigmask` manipulation. Thanks to https://www.doof.me.uk/2020/09/23/sigpipe-and-how-to-ignore-it/ and http://www.microhowto.info:80/howto/ignore_sigpipe_without_affecting_other_threads_in_a_process.html
Provide a mechanism for callers to read from stderr.
Provide more user-friendly error messages in smart protocol negotiation failures.
Don't capture stderr, optimize for the CLI case.
Provide both cmdline-style handling (passing it to the shell on POSIX, or directly to CreateProcess on win32) and execv style (passing it directly to execv on POSIX, and mangling it into a single command-line on win32).
Callers can specify the ssh command to invoke using `core.sshcommand` or the `GIT_SSH` environment variable. This is useful for specifying alternate configuration, and is particularly useful for our testing environment.
This helped when troubleshooting issues running the `ci/test.sh` script locally.
Handle custom paths for OpenSSH.
This was referenced Feb 20, 2025
This was referenced Dec 10, 2025
This was referenced Dec 24, 2025
This was referenced Dec 31, 2025
This was referenced Jan 7, 2026
This was referenced Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Provide a smart transport that executes
ssh ...- this adds a mechanism for executing processes from libgit2, and uses it to invokesshand deal with the output.