github-auth
БесплатноБез исполняемых скриптовНе проверенSecurely authenticate with GitHub using stored credentials for API operations and git commands
Об этом скилле
GitHub Authentication
This skill provides secure access to GitHub credentials for API operations, repository management, and git commands.
Instructions
When helping with GitHub operations that require authentication:
Credential Location
Credentials are stored in the project root
.envfileCross-platform path examples:
- Linux/macOS:
~/apps/your_claude_skills/.envor use relative path:./.env - Windows:
%USERPROFILE%\apps\your_claude_skills\.envor relative:.\.env
- Linux/macOS:
Load credentials:
# Linux/macOS: source ./.env # Windows PowerShell: # Get-Content .\.env | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } }Access in scripts:
# Linux/macOS: GITHUB_USERNAME=$(grep GITHUB_USERNAME ./.env | cut -d= -f2) GITHUB_PAT=$(grep GITHUB_PAT ./.env | cut -d= -f2) # Windows PowerShell: # $GITHUB_USERNAME = (Get-Content .\.env | Select-String "GITHUB_USERNAME").Line.Split("=")[1] # $GITHUB_PAT = (Get-Content .\.env | Select-String "GITHUB_PAT").Line.Split("=")[1]
GitHub API Operations
Use the GitHub CLI (gh) for authenticated operations:
# Authenticate gh with stored PAT
echo "$GITHUB_PAT" | gh auth login --with-token
# Or use API directly with curl
curl -H "Authorization: token $GITHUB_PAT" https://api.github.com/user/repos
Git Operations with Authentication
⚠️ SECURITY WARNING: Embedding credentials in URLs is a security risk. Use SSH keys or git credential helper instead.
RECOMMENDED: Use SSH Keys
# Setup SSH key for GitHub (one-time setup)
ssh-keygen -t ed25519 -C "[email protected]"
cat ~/.ssh/id_ed25519.pub # Add this to GitHub Settings > SSH Keys
# Clone with SSH (RECOMMENDED)
git clone [email protected]:owner/repo.git
# Add SSH remote
git remote add origin [email protected]:owner/repo.git
ALTERNATIVE: Use Git Credential Helper
# Configure git credential helper (stores credentials securely)
git config --global credential.helper store
# First time will prompt for credentials, then stores them securely
git clone https://github.com/owner/repo.git
NOT RECOMMENDED: Credentials in URL (only for automation/CI)
# WARNING: Credentials in URLs can leak in logs/history
# Only use in secure, automated environments
git clone https://$GITHUB_USERNAME:[email protected]/owner/repo.git
Common GitHub Operations
Create Repository
gh repo create owner/repo --private --description "Description"List Repositories
gh repo listCreate Pull Request
gh pr create --title "Title" --body "Description"Manage Issues
gh issue create --title "Issue" --body "Description" gh issue listRelease Management
gh release create v1.0.0 --title "Release 1.0.0" --notes "Release notes"
Security Best Practices
Never Echo or Display PAT
- Never use
echo $GITHUB_PATor display the token - Use it directly in commands or pipe to stdin
- Keep .env file permissions restricted (chmod 600)
- Never use
Use gh CLI When Possible
- Prefer
ghcommands over raw API calls - gh stores credentials securely
- Better error handling and user-friendly output
- Prefer
Never Put Credentials in Git URLs
- Credentials in URLs can leak in git history, logs, and error messages
- Use SSH keys or git credential helper instead
- Only use URL credentials in secure CI/CD environments
Verify .env is Gitignored
- Always check .gitignore includes .env
- Never commit credentials to git
- Use .env.example for documentation
Rotate Tokens Regularly
- GitHub PATs should be rotated periodically
- Revoke old tokens after rotation
- Update .env file with new token
Error Handling
If authentication fails:
- Verify PAT is valid in .env file
- Check PAT has required scopes (repo, workflow, etc.)
- Verify PAT hasn't expired
- Test with:
gh auth status
Examples
Example 1: Create and Push to New Repo
# Load credentials (Linux/macOS):
source ./.env
# Load credentials (Windows PowerShell):
# Get-Content .\.env | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } }
# Create private repository
gh repo create yourusername/my-new-repo --private --description "My new project"
# Initialize local repo and push
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/yourusername/my-new-repo.git
git push -u origin main
Example 2: Clone Private Repo (SSH - RECOMMENDED)
# Clone with SSH (most secure)
git clone [email protected]:yourusername/private-repo.git
Example 2b: Clone with Credential Helper
# First time setup (one-time)
git config --global credential.helper store
Установить github-auth в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл github-auth?
Securely authenticate with GitHub using stored credentials for API operations and git commands
Как установить скилл github-auth?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл github-auth запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic