pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

OpenSSH support

Open janheini opened this issue 3 months ago • 1 comments

Hey,

libgit v1.8.0 introduced OpenSSH support. This allows libgit to automatically find ssh keys and respect the ssh config which libssh2 does not (see https://github.com/libgit2/libgit2/issues/5640).

Are there any plans on enabling OpenSSH support in pygit2?

In my mind this is as simple as setting $USE_SSH="exec" in build.sh.

Thank you

janheini avatar Dec 01 '25 14:12 janheini

In my mind this is as simple as setting $USE_SSH="exec" in build.sh.

Might need to adjust build.sh a bit:

--- a/build.sh
+++ b/build.sh
@@ -168,7 +168,7 @@ if [ -n "$LIBSSH2_VERSION" ]; then
     cmake --build . --target install
     cd ..
     USE_SSH=ON
-else
+else if [[ -z "${USE_SSH+x}" ]]; then
     USE_SSH=OFF
 fi

This way you can set USE_SSH=exec before running build.sh. And this would only work if building the pygit2 package from source on a machine where OpenSSH is installed.

This is not a good idea for shipping pygit2 wheels to consumers. The implementation of SSH should be cross-compiled and distributed in the pygit2 wheel for whatever platform you're implying.

2bndy5 avatar Dec 04 '25 07:12 2bndy5