codespace-gh-auth
Extract GitHub token from VS Code for API in Codespaces.
Skill by gitricko
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/gitricko-codespace-gh-auth
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Shell scripts
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/codespace-gh-auth
What's inside
- Skill name
codespace-gh-auth- Description
- Extract GitHub token from VS Code for API in Codespaces.
- License
- MIT
- Instructions
- 77 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Agent Skills spec issues
- body: contains an absolute path from the author's machine
Files (3)
- SKILL.md
- git-push-with-token.md · references/
- codespace-gh-auth.sh · scripts/
SKILL.md (first lines)
# GitHub Codespace Authentication
## Problem
In a GitHub Codespace, the GITHUB_TOKEN env var is set in the VS Code server process but NOT inherited by the Hermes agent session.
## Solution
### Quick Usage (Source the script, then use functions)
```bash
source /home/codespace/.hermes/skills/minions/codespace-gh-auth/scripts/codespace-gh-auth.sh
# Get token for API calls
get_github_token
curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/...
# Push with token-embedded URL (no credential prompts)
git_push_with_token
# Set up gh CLI
setup_gh_cli
gh pr create ...
# Full workflow: commit → push → PR
codespace_create_pr "Title" "Body"
```
### Step 1: Extract the real GITHUB_TOKEN from the VS Code server
```bash
VSCODE_PID=$(pgrep -f "server-main.js" | head -1)
GITHUB_TOKEN=$(cat /proc/$VSCODE_PID/environ 2>/dev/null | tr '\0' '\n' | grep "^GITHUB_TOKEN=" | cut -d= -f2-)
```
### Step 2: Use it for API calls
```bash
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/OWNER/REPO/issues/ISSUE_NUM/comments" \
-d '{"body": "your comment"}'
```
### Step 3: Use it for gh CLI (optional)
```bash
unset GH_TOKEN
export GH_TOKEN="$GITHUB_TOKEN"
gh auth status
```
## Pitfalls
- Do NOT use GITHUB_CODESPACE_TOKEN for REST API calls (returns 401)
- Do NOT run gh auth login (unnecessary)
- The VS Code server PID can be found with: pgrep -f "server-main.js"
- Token is a GitHub App user-to-server token (ghu_xxx prefix), ~40 chars
- **Critical limitation**: This is a GitHub App token gated by Codespaces app installation. It works for the origin repo and Codespaces-connected repos, but FAILS (403) on other repos the user has access to. Use device code flow for those cases.
### Token Scope Comparison
| Method | Token Type | Scope | Works On |
|--------|------------|-------|----------|
| **Extract from VS Code** | GitHub App user-to-server (`ghu_`) | `repo` (app-gated) | Origin repo + Codespaces-connected repos only |
| **Device code flow** | Classic OAuth (`gho_`/`ghp_`) | Full user scopes | **All repos the user has access to** |
| **Unauthenticated API** | None | Public only | Public repos (read-only) |
**When to use device flow instead**: Working on repos outside the Codespaces app installation (other users' repos, orgs without Codespaces app).
## Scripts
- `scripts/codespace-gh-auth.sh` — Reusable functions: `get_github_token`, `git_push_with_token`, `setup_gh_cli`, `codespace_create_pr`
## References
- `references/git-push-with-token.md` — Complete git push + PR workflow using extracted tokenFrom gitricko/.minions, MIT.
More from gitricko/.minions
- 0.586score
ci-lint-check
gitricko
Run pre-commit CI lint validation locally before pushing to avoid GitHub Actions failures.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
minions-llm-proxy-ops
gitricko
Use when operating or debugging the .minions LLM proxies.
SkillAFreshness: A★ 1Claude Code +9 - 0.583score
ci-debugging
gitricko
Use when a CI/test failure seems to have one cause but the real root is different, or when a silent failure hides the real issue.
SkillAFreshness: A★ 1Claude Code +9 - 0.583score
codespace-port-visibility
gitricko
Automate Codespace port visibility via CLI w/ vscode token.
SkillAFreshness: A★ 1Claude Code +9 - 0.580score
docker-test-shell
gitricko
Use when testing in a clean throwaway container.
SkillAFreshness: A★ 1Claude Code +9 - 0.578score
adopting-external-skills
gitricko
Import external skills into the Codespace tree, adapted.
SkillAFreshness: A★ 1Claude Code +9 - 0.574score
minions-9router-models
gitricko
Manage 9Router model list via etc/9router-models.json.
SkillAFreshness: A★ 1Claude Code +9 - 0.549score
codespace-webtop
gitricko
Native Selkies/XFCE webtop (browser desktop) via pixelflux-based selkies package — install, run, and autostart on any Ubuntu base system
SkillBFreshness: B★ 1Claude Code +9 - 0.547score
ci-log-capture
gitricko
Use when test scripts redirect probe output to /dev/null, hiding failure details.
SkillBFreshness: B★ 1Claude Code +9 - 0.546score
codespace-vscode-open
gitricko
Auto-discover VS Code CLI in Codespaces and open files in connected editor
SkillBFreshness: B★ 1Claude Code +9 - 0.546score
agent-context-transfer
gitricko
Transfer implementation context to a fresh agent for seamless handoff
SkillBFreshness: B★ 1Claude Code +9 - 0.546score
codespace-lavish
gitricko
Launch a headed Lavish-AXI whiteboard over noVNC in Codespaces.
SkillBFreshness: B★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 2
- Open issues
- 3
- Last commit (this folder)
- Oct 13, 2026 (16 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/gitricko/.minions
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gitricko
- 0.586score
ci-lint-check
gitricko
Run pre-commit CI lint validation locally before pushing to avoid GitHub Actions failures.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
minions-llm-proxy-ops
gitricko
Use when operating or debugging the .minions LLM proxies.
SkillAFreshness: A★ 1Claude Code +9 - 0.583score
ci-debugging
gitricko
Use when a CI/test failure seems to have one cause but the real root is different, or when a silent failure hides the real issue.
SkillAFreshness: A★ 1Claude Code +9 - 0.583score
codespace-port-visibility
gitricko
Automate Codespace port visibility via CLI w/ vscode token.
SkillAFreshness: A★ 1Claude Code +9 - 0.580score
docker-test-shell
gitricko
Use when testing in a clean throwaway container.
SkillAFreshness: A★ 1Claude Code +9 - 0.578score
adopting-external-skills
gitricko
Import external skills into the Codespace tree, adapted.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
codespace-gh-auth skill. Agent Mart. https://agentmart.dev/skills/gitricko-codespace-gh-auth (last updated 2026-10-24)