Skip to content

fix: implement SSH clone with native interactive protocol#17

Merged
mizchi merged 1 commit into
mainfrom
fix/ssh-clone-interactive-protocol
Feb 23, 2026
Merged

fix: implement SSH clone with native interactive protocol#17
mizchi merged 1 commit into
mainfrom
fix/ssh-clone-interactive-protocol

Conversation

@mizchi
Copy link
Copy Markdown
Member

@mizchi mizchi commented Feb 23, 2026

Summary

  • Remove --stateless-rpc flags from SSH remote command (build_upload_pack_remote_command)
  • Add pipe-based SSH interactive fetch (run_ssh_upload_pack_interactive) using spawn_orphan to properly sequence: read refs → write wants → read pack
  • File-based stdin fails for SSH because the client sends EOF before the server processes wants; pipe-based I/O solves this by keeping stdin open until wants are written

Test plan

  • bit clone git@github.com:bit-vcs/bit-relay.git (SCP format)
  • bit clone ssh://git@github.com/bit-vcs/bit-relay.git (SSH URL format)
  • bit clone git@github.com:bit-vcs/bit.git (larger repo)
  • All 1103 existing tests pass
  • Unit tests updated to verify no --stateless-rpc in SSH commands

Fixes #13

🤖 Generated with Claude Code

SSH transport was failing because `build_upload_pack_remote_command`
always added `--stateless-rpc` flags, which are rejected by SSH
servers like GitHub.

The fix has two parts:

1. Remove `--stateless-rpc` from the SSH remote command so it uses
   the native git interactive protocol.

2. Add pipe-based I/O for SSH fetch requests. File-based stdin
   doesn't work because SSH sends EOF immediately before the server
   processes wants. The new `run_ssh_upload_pack_interactive` function
   uses `spawn_orphan` with pipe stdin/stdout to properly sequence:
   read ref advertisement → write wants → close stdin → read pack.

Fixes #13

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mizchi mizchi merged commit 52549b1 into main Feb 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bit clone with SSH is not working (https is ok)

1 participant