/github:github-authfrom github
Guides users through GitHub authentication methods including device code flow, personal access tokens, fine-grained tokens, and GitHub App authorization for CLI operations, API access, and cross-repo workflows.
Ships in github. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill covers all GitHub authentication methods relevant to Claude Code sessions. It enables Claude to guide users through the appropriate auth flow for their use case.
| Method | Best For | Expires | Scope Control |
|---|---|---|---|
| Device Code Flow | Interactive CLI sessions | Session-based | Per-login |
| Personal Access Token (classic) | Simple automation, CI | Configurable / never | Broad scopes |
| Fine-Grained PAT | Targeted repo access | Configurable (max 1yr) | Per-repo, granular |
| GitHub App (as app) | Automated systems, bots | 1 hour (installation token) | Per-installation |
| GitHub App (as user) | User-to-server, OAuth | Session-based | Per-authorization |
Best for: Claude Code sessions where the user is present and can authorize in a browser.
BROWSER=false gh auth login
This outputs:
ABCD-1234)https://github.com/login/deviceThe user visits the URL, enters the code, and authorizes access.
# GitHub.com with HTTPS
BROWSER=false gh auth login --hostname github.com --git-protocol https
# With specific scopes
BROWSER=false gh auth login --scopes "repo,read:org,write:packages"
# GitHub Enterprise
BROWSER=false gh auth login --hostname github.mycompany.com
| Scope | Description |
|---|---|
repo | Full control of private repositories |
read:org | Read organization membership |
write:org | Read and write organization membership |
read:packages | Download packages from GitHub Packages |
write:packages | Upload packages to GitHub Packages |
admin:public_key | Manage public keys |
gist | Create gists |
workflow | Update GitHub Action workflows |
# Check current status
gh auth status
# Refresh expired token
BROWSER=false gh auth refresh
# Switch accounts
gh auth switch --user username
# Logout
gh auth logout
Best for: Simple automation, CI pipelines, or when device code flow isn't available.
https://github.com/settings/tokens# Authenticate with token
echo "$GH_TOKEN" | gh auth login --with-token
# Or set as environment variable
export GH_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
export GITHUB_TOKEN="$GH_TOKEN" # Also recognized by git and many tools
# Via credential helper
git config --global credential.helper store
# Then use token as password when prompted
# Or via URL
git clone https://x-access-token:${GH_TOKEN}@github.com/owner/repo.git
repo grants access to ALL repos)Best for: Targeted access to specific repositories with minimal permissions.
https://github.com/settings/personal-access-tokens/newSame as classic PATs — set GH_TOKEN or GITHUB_TOKEN environment variable.
Best for: Automated systems, bot identities, long-running agent sessions.
GitHub Apps authenticate using a two-step process:
# Step 1: Generate JWT
NOW=$(date +%s)
IAT=$((NOW - 60))
EXP=$((NOW + 540))
HEADER=$(echo -n '{"alg":"RS256","typ":"JWT"}' | base64 | tr -d '=' | tr '/+' '_-' | tr -d '\n')
PAYLOAD=$(echo -n "{\"iss\":\"${GITHUB_APP_ID}\",\"iat\":${IAT},\"exp\":${EXP}}" | base64 | tr -d '=' | tr '/+' '_-' | tr -d '\n')
SIGNATURE=$(echo -n "${HEADER}.${PAYLOAD}" | openssl dgst -sha256 -sign "$GITHUB_APP_PRIVATE_KEY_PATH" | base64 | tr -d '=' | tr '/+' '_-' | tr -d '\n')
JWT="${HEADER}.${PAYLOAD}.${SIGNATURE}"
# Step 2: Exchange for installation token
curl -s -X POST \
-H "Authorization: Bearer ${JWT}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/app/installations/${GITHUB_INSTALLATION_ID}/access_tokens"
| Variable | Description |
|---|---|
GITHUB_APP_ID | The GitHub App's numeric ID |
GITHUB_APP_PRIVATE_KEY_PATH | Path to PEM private key file |
GITHUB_INSTALLATION_ID | Installation ID for the target account/org |
# With gh CLI
export GH_TOKEN="ghs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# With git
git config credential.https://github.com.helper \
'!f() { echo "protocol=https"; echo "host=github.com"; echo "username=x-access-token"; echo "password=${GH_TOKEN}"; }; f'
GitHub Apps can also act on behalf of a user via OAuth:
https://github.com/login/oauth/authorize?client_id=APP_CLIENT_IDThis is useful when the app needs to act as a specific user rather than as itself.
Is a user present and interactive?
Do you need access to specific repos only?
Is this for a long-running automated system?
Do you need a bot identity (not a user)?
chmod 600https://github.com/settings/applications| Error | Cause | Solution |
|---|---|---|
HTTP 401 | Token expired or invalid | Re-authenticate or generate new token |
HTTP 403 | Insufficient permissions | Check scopes; re-authenticate with more |
HTTP 404 | Private repo, not authenticated | Authenticate to access private repos |
SSO Required | Organization requires SSO | Authorize SSO in browser settings |
Bad credentials | Token revoked or malformed | Re-authenticate from scratch |
JWT expired | GitHub App JWT older than 10 min | Regenerate JWT and retry |
Installation suspended | App installation was suspended | Contact org admin |
| Method | Storage Location |
|---|---|
gh auth login | ~/.config/gh/hosts.yml |
GH_TOKEN env var | Process environment |
GITHUB_TOKEN env var | Process environment |
| GitHub App token file | ~/.config/agent/github-token (convention) |
| Git credential helper | OS keychain or ~/.git-credentials |
For organizations requiring SAML SSO:
https://github.com/settings/applicationsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/ghUse this skill when the user asks about GitHub operations, pull requests, issues, releases, actions, gists, repos, or any task involving the GitHub CLI (gh). Also use when needing to interact with GitHub APIs, check CI status, review PRs, manage labels, create releases, or automate GitHub workflows from the command line.
/pr-feedbackAddress PR feedback (review comments, inline suggestions, CI failures) systematically. Use when you need to fetch, triage, and respond to pull request reviews, comments, or failing CI checks. Covers the full feedback loop: gather context, evaluate each item, take action (fix, disagree, defer, or clarify), commit with attribution, and request re-review. <example>address the PR feedback</example> <example>fix the CI failures on my PR</example> <example>respond to the review comments</example> <example>handle the PR review</example> <example>address inline comments on PR #42</example> <example>the reviewer left feedback, can you fix it</example> <example>CI is failing on the PR</example>
npx claudepluginhub nsheaps/ai-mktpl --plugin github2 plugins in one repository ship this exact skill · first indexed Sep 28, 2026