Skip to content

Add si repo clone and a git credential helper - #6

Merged
setoelkahfi merged 1 commit into
developmentfrom
cli/repo-clone-git-auth
Oct 28, 2026
Merged

setoelkahfi merged 1 commit into
developmentfrom
cli/repo-clone-git-auth

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

You can't clone or push a private repo with si today. This adds the pieces for that.

  • si repo clone OWNER/NAME [DIR] [-- git args] runs git clone with a credential helper that points back at si. The token is never in the URL or on disk, and a missing git gives a clear error.
  • si auth git-credential <get|store|erase> (hidden) speaks git's helper protocol. On get for the configured host it mints a git password and prints it. store and erase do nothing. If nobody is signed in, or the host or scheme doesn't match, it prints nothing so git tries the next helper.
  • si auth setup-git writes the helper into the global git config, like gh auth setup-git.

Cloning a public repo works without signing in.

Checked with cargo fmt --check, cargo clippy -D warnings, cargo test --workspace and cargo check -p sigit-si-api --no-default-features. New tests cover the protocol parsing (host match, other hosts ignored, blank line ends the request) and the clone arguments.

This is the first PR of a stack that brings si up to the 1.10 API. The next ones add commit statuses, agent runs, sites and account commands, then the 1.3.0 bump.

si repo clone OWNER/NAME runs git clone with a credential helper that
points back at si, so the token is never put in the URL or written to
disk. Extra arguments after -- go to git.

si auth git-credential implements git's helper protocol. On get, for the
configured host only, it mints a short-lived git password and prints it.
store and erase do nothing, and it prints nothing when nobody is signed
in so git moves on to the next helper. si auth setup-git writes the
helper into the global git config, like gh auth setup-git.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@setoelkahfi
setoelkahfi added this pull request to stack #12 October 28, 2026 09:16
@setoelkahfi
setoelkahfi requested a review from paydii October 28, 2026 09:16
@setoelkahfi setoelkahfi self-assigned this Oct 28, 2026
@setoelkahfi
setoelkahfi marked this pull request as ready for review October 28, 2026 10:56

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces support for cloning and authenticating private repositories via si, by implementing a git credential helper protocol and wiring it into the CLI. The new si repo clone command runs git clone with a custom credential helper that securely provides a token only for the configured host, never writing it to disk or the URL. The helper is registered via si auth setup-git, and the protocol is implemented in a new credential.rs module, which is well-covered by new tests. The changes are cleanly integrated into the CLI and command dispatch, with clear error handling for missing git and protocol edge cases. Previous findings appear addressed, and the new code is modular and testable.


Automated review by siGit Code Review · commit ffcb7e8 · see the review dashboard

@setoelkahfi
setoelkahfi merged commit 601450a into development Oct 28, 2026
1 check 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.

2 participants