Skip to content

Add GitHub CLI to devcontainer with persistent auth#47

Merged
RaoulSchaffranek merged 2 commits into
mainfrom
add-gh-cli-devcontainer
Jul 23, 2026
Merged

Add GitHub CLI to devcontainer with persistent auth#47
RaoulSchaffranek merged 2 commits into
mainfrom
add-gh-cli-devcontainer

Conversation

@RaoulSchaffranek

Copy link
Copy Markdown
Member

Summary

  • Install gh (GitHub CLI) in the devcontainer via nix profile install, alongside the existing bootstrap tooling (direnv, nodejs).
  • Persist gh credentials across container rebuilds using a named volume (gh-config-${devcontainerId}) mounted at ~/.config/gh — the same pattern the .claude config already uses. The postCreateCommand chown is extended to cover the new volume so gh (running as vscode) can write to it.
  • Add CONTRIBUTOR.md documenting gh auth login, noting that the token survives rebuilds, and walking through creating a fine-grained personal access token with least-privilege permissions scoped to a single repository.

Notes

  • Installed via Nix to match the container's existing bootstrap-tooling pattern (the apt route would require adding GitHub's apt key/repo).
  • No GH_TOKEN env var is wired up — the token is stored by gh in the persisted volume rather than as a plaintext env var on the host.

Install gh via nix profile alongside the other bootstrap tooling, and
persist its credentials across rebuilds with a named volume mounted at
~/.config/gh. Add CONTRIBUTOR.md documenting gh auth and how to create a
minimal-permission fine-grained token.
Condense the token instructions to the minimal required permissions and
add a signing-commits section clarifying that only a signing key (SSH or
GPG) belongs in the container -- an SSH authentication key grants full
account access and would bypass the fine-grained PAT.
@RaoulSchaffranek
RaoulSchaffranek merged commit d9b04b5 into main Jul 23, 2026
1 check failed
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.

1 participant