feat: route git push auth to the right token by GitHub org#11
Merged
Conversation
Add a global credential helper that picks a token based on the repo's GitHub org (Blueprint-Talent→BTG_GITHUB_TOKEN, confiador→CONFIADOR_ GITHUB_TOKEN, else GITHUB_TOKEN), read from env at push time and never stored. Wired into on-create so it survives rebuilds; documented in AUTH-PERSISTENCE.md and secrets.example. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds a global git credential helper that hands
git pushthe correct GitHub token based on the repo's org — so plaingit pushworks in any repo built from this template, with no per-repo setup.Blueprint-Talent/*BTG_GITHUB_TOKENconfiador/*CONFIADOR_GITHUB_TOKENGITHUB_TOKEN(fallback)Why
GITHUB_TOKEN(personal) is read-only on org repos, so pushes 403'd. Previously you had to override the token per push. Routing by org removes that entirely.How
scripts/git-credential-org-router.sh— reads the org from the credential request (useHttpPath=truepasses the path), emits the matching token from the env. Tokens are read at push time and never written to disk (not in.git/config, the remote URL, or output).on-create/setup-git-credentials.sh— wires it into global git config.~/.gitconfigisn't a persisted volume, so re-applying on each create is what makes it survive rebuilds.AUTH-PERSISTENCE.md; tokens registered insecrets.example.Adding an org later: one
caseline in the helper + the matching*_GITHUB_TOKENin host secrets.Descendants pick this up via
scripts/sync-devcontainer.sh(new files auto-added;on-create.shclean 3-way merge), then a devcontainer rebuild.🤖 Generated with Claude Code