Add SSH transport support#54
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ceeddf9. Configure here.
This was referenced May 14, 2026
nodo
previously approved these changes
May 18, 2026
Collaborator
nodo
left a comment
There was a problem hiding this comment.
LGTM, just added a minor comment, not a blocker.
Comment on lines
+102
to
+104
| return strings.Contains(msg, "Invalid command:") && | ||
| strings.Contains(msg, "GIT_PROTOCOL='version=2'") && | ||
| strings.Contains(msg, "git-upload-pack") |
Collaborator
There was a problem hiding this comment.
🤔 not a blocker, but I wonder if we could do a pass and handle these better. e.g. is this specific to github?
Entire-Checkpoint: f97b592d8e72
Entire-Checkpoint: 9dc3927cec43
Entire-Checkpoint: 1ae05f312d98
Entire-Checkpoint: f9da8767b8db
Entire-Checkpoint: 5f03021cd910
Entire-Checkpoint: 338b03e03d07
Entire-Checkpoint: 4dd13848aefc
Entire-Checkpoint: 5f82375c7a8a
Entire-Checkpoint: 557dfe4672e0
Entire-Checkpoint: ae52adb63cec
nodo
approved these changes
May 18, 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.

Summary
Adds SSH transport support to
git-syncusing the localsshbinary.This replaces the stalled SSH draft with a fresh implementation from current
main.What changed
HTTPConnSSHConnusing onesshprocess per logical RPCssh://, SCP-stylegit@host:path.git, andgit+ssh://remotesgit@usersshis not available onPATH--progress/--statsdo not yet expose byte-counted SSH throughputImplementation notes
The key transport fix versus the old draft is per-RPC execution.
git-syncmakes multiple logical RPCs per endpoint in normal flows, especially under protocol v2 and batching, so a single long-lived SSH process is the wrong model.Each
RequestInfoRefs/PostRPCStreamBodycall now shells out independently viaexec.CommandContext, which also fixes the earlier context-handling and stderr-race issues.The SSH transport trims the leading advertised-refs section emitted by fresh
upload-pack/receive-packinvocations before exposing the actual command stream.Tests
Added and updated coverage for:
gitproto, strategies, and syncer~-prefixed SCP pathsgit-upload-pack/git-receive-packVerified locally with:
go test ./internal/gitproto ./internal/syncer -run 'TestSSHConn|TestRun_IntegrationSyncOverSSHShimV2|TestSSHStatsWarning' -count=1go test ./internal/gitproto ./internal/strategy/... ./internal/syncer -run '^$'Remaining caveat
SSH sync works, but
--progressand--statscurrently omit byte-counted SSH transfer throughput. The PR warns explicitly rather than silently reporting misleading zero-byte stats.Closes #36
Note
Medium Risk
Adds a new SSH transport and refactors core fetch/push/session plumbing to use an interface-based connection, which touches critical sync paths and could affect remote compatibility and error handling across both HTTP and SSH.
Overview
git-syncnow supports SSH remotes by introducing a transport-agnosticgitproto.Conninterface, renaming the existing smart-HTTP transport toHTTPConn, and adding a newSSHConnthat shells out to the localsshbinary per RPC (discovery and streaming RPCs).Core fetch/push/refs code and all strategies (
bootstrap,incremental,replicate,materialized) are updated to acceptConninstead of*Conn, with progress output routed viaConn.ProgressWriter()and session teardown now callingConn.Close().The CLI/session layer (
syncer) now detectsssh/git+ssh(and SCP-style) URLs to buildSSHConn, prints a warning that--progress/--statsomit SSH byte throughput, and docs/tests are updated with SSH usage notes plus unit and integration coverage for SSH invocation, context cancellation, and end-to-end sync over an SSH shim.Reviewed by Cursor Bugbot for commit ceeddf9. Configure here.