Repository navigation
feat: replicate with a different gh account per side - #13
Merged
Merged
Conversation
--source-account and --target-account select already-authenticated github.com accounts independently. Each side gets its own API client and its own token in the Git subprocesses, and both logins are proven with GET /user before the clone, so a mixed-up credential fails before anything is written. The active gh account, credential storage and global Git configuration are untouched, and the single-account path is unchanged when neither flag is given.
This was referenced Oct 24, 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.
Closes #11.
What changed
gh replicatecan now read the source and write the destination with two different accounts that are already authenticated ingh.api.RESTClientand its own token, injected into that side's Git subprocesses after stripping inheritedGH_TOKEN/GITHUB_TOKEN.GET /user. A token that authenticates as another account aborts with a message naming both logins and stating that nothing was changed.ghaccount, credential storage and global Git configuration are never modified.How tested
go test -race ./...: 35 tests, including the new coverage for token isolation in the Git environment, account resolution failures, identity enforcement and the abort-before-write path.gofmt,go vet,go build,go mod tidyclean;govulncheckreports no vulnerabilities with the Go version pinned in CI.github.com: reads were made with the source account, and every release and asset in the destination was created by the target account. The source account has no access to the destination, and the global active account was unchanged afterwards.Notes
GHES and cross-host replication remain out of scope (#4).