Repository navigation
Add si repo clone and a git credential helper - #6
Conversation
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]>
There was a problem hiding this comment.
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
You can't clone or push a private repo with
sitoday. This adds the pieces for that.si repo clone OWNER/NAME [DIR] [-- git args]runsgit clonewith a credential helper that points back atsi. The token is never in the URL or on disk, and a missinggitgives a clear error.si auth git-credential <get|store|erase>(hidden) speaks git's helper protocol. Ongetfor the configured host it mints a git password and prints it.storeanderasedo 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-gitwrites the helper into the global git config, likegh auth setup-git.Cloning a public repo works without signing in.
Checked with
cargo fmt --check,cargo clippy -D warnings,cargo test --workspaceandcargo 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
siup to the 1.10 API. The next ones add commit statuses, agent runs, sites and account commands, then the 1.3.0 bump.