Securely authenticate with GitHub using stored credentials for API operations and git commands
This skill provides secure access to GitHub credentials for API operations, repository management, and git commands.
When helping with GitHub operations that require authentication:
Credentials are stored in the project root .env file
Cross-platform path examples:
~/apps/your_claude_skills/.env or use relative path: ./.env%USERPROFILE%\apps\your_claude_skills\.env or relative: .\.envLoad 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]
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
⚠️ 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 "your_email@example.com"
cat ~/.ssh/id_ed25519.pub # Add this to GitHub Settings > SSH Keys
# Clone with SSH (RECOMMENDED)
git clone git@github.com:owner/repo.git
# Add SSH remote
git remote add origin git@github.com: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:$GITHUB_PAT@github.com/owner/repo.git
Create Repository
gh repo create owner/repo --private --description "Description"
List Repositories
gh repo list
Create Pull Request
gh pr create --title "Title" --body "Description"
Manage Issues
gh issue create --title "Issue" --body "Description"
gh issue list
Release Management
gh release create v1.0.0 --title "Release 1.0.0" --notes "Release notes"
Never Echo or Display PAT
echo $GITHUB_PAT or display the tokenUse gh CLI When Possible
gh commands over raw API callsNever Put Credentials in Git URLs
Verify .env is Gitignored
Rotate Tokens Regularly
If authentication fails:
gh auth status# 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
# Clone with SSH (most secure)
git clone git@github.com:yourusername/private-repo.git
# First time setup (one-time)
git config --global credential.helper store
# Clone - will prompt for credentials first time, then cache
git clone https://github.com/yourusername/private-repo.git
# Load credentials (Linux/macOS):
source ./.env
# Load credentials (Windows PowerShell):
# Get-Content .\.env | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } }
# List user's repositories (Linux/macOS):
curl -s -H "Authorization: token $GITHUB_PAT" \
https://api.github.com/user/repos | jq -r '.[].full_name'
# Windows PowerShell:
# $headers = @{ Authorization = "token $env:GITHUB_PAT" }
# (Invoke-RestMethod -Uri "https://api.github.com/user/repos" -Headers $headers).full_name
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer