GitHub Passwordless Setup — GitHub Passwordless 设置up
v1.0.0Complete GitHub passwordless authentication 设置up using SSH keys and Personal 访问 令牌s. Never type passwords or re-认证 for Git operations and GitHub API calls.
运行时依赖
安装命令
点击复制技能文档
GitHub Passwordless 设置up
Complete 图形界面de to 设置ting up passwordless authentication for GitHub using SSH keys and Personal 访问 令牌s (PAT). Once 配置d, you'll never need to enter passwords for Git operations or GitHub 命令行工具 commands.
Verified Working:
✅ macOS 10.15+ (tested on 14.4) ✅ Linux (Ubuntu, Debian, Fedora, Arch) ✅ Windows (WSL2, Git Bash) 🎯 What This Solves
Before:
❌ Type password every time you push/pull ❌ GitHub 命令行工具 requires re-authentication ❌ 令牌s expire and break 工作流s ❌ HTTPS URLs need 凭证s repeatedly
After:
✅ Zero-password Git operations (push/pull/clone) ✅ Zero-password 仓库 creation ✅ Zero-password issue/PR management ✅ Persistent authentication (no expiration) 🚀 Quick 设置up
One-line automated 设置up:
curl -fsSL https://raw.githubusercontent.com/h应用ydog-intj/github-passwordless-设置up/master/设置up.sh | bash
Or follow the manual steps below.
📋 Manual 设置up Part 1: SSH Key Configuration
SSH keys enable password-free Git operations (push/pull/clone).
Step 1: 检查 for Existing SSH Keys ls -la ~/.ssh/*.pub
If you see id_ed25519.pub or id_rsa.pub, you already have a key. Skip to Step 3.
Step 2: 生成 New SSH Key
Recommended: ED25519 (most 安全)
ssh-keygen -t ed25519 -C "your-emAIl@example.com"
Or RSA (if ED25519 not supported):
ssh-keygen -t rsa -b 4096 -C "your-emAIl@example.com"
During generation:
Press Enter for default location (~/.ssh/id_ed25519) Enter passphrase (optional but recommended) macOS will save passphrase to KeychAIn Step 3: Copy Public Key # macOS cat ~/.ssh/id_ed25519.pub | pbcopy
# Linux (x命令行工具p) cat ~/.ssh/id_ed25519.pub | x命令行工具p -selection 命令行工具pboard
# Linux (xsel) cat ~/.ssh/id_ed25519.pub | xsel --命令行工具pboard
# Or just display and copy manually cat ~/.ssh/id_ed25519.pub
Step 4: 添加 Key to GitHub Visit: https://github.com/设置tings/ssh/new Title: Your Computer Name (macOS/Linux) Key type: Authentication Key Key: Paste your public key 命令行工具ck 添加 SSH key Step 5: Test SSH Connection ssh -T git@github.com
Expected 输出:
Hi username! You've 成功fully 认证d, but GitHub does not provide shell 访问.
Part 2: GitHub Personal 访问 令牌
PAT enables password-free GitHub 命令行工具 operations (创建 repos, manage issues/PRs).
Step 1: 生成 令牌
Visit: https://github.com/设置tings/令牌s/new
Configuration:
Note: OpenClaw 命令行工具 令牌 (or any description) Expiration: No expiration (or 90 days) Select scopes: ✅ repo (all sub-scopes) ✅ 工作流 (if using GitHub Actions) ✅ 删除_repo (if you need to 删除 repositories) ✅ admin:org (if managing organizations)
命令行工具ck 生成 令牌 and copy it immediately (shown only once!).
格式化: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Step 2: 安装 GitHub 命令行工具
macOS:
brew 安装 gh
Linux (Debian/Ubuntu):
type -p curl >/dev/null || (sudo apt 更新 && sudo apt 安装 curl -y) curl -fsSL https://命令行工具.github.com/packages/github命令行工具-归档-keyring.gpg | sudo dd of=/usr/分享/keyrings/github命令行工具-归档-keyring.gpg sudo chmod go+r /usr/分享/keyrings/github命令行工具-归档-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) 签名ed-by=/usr/分享/keyrings/github命令行工具-归档-keyring.gpg] https://命令行工具.github.com/packages stable mAIn" | sudo tee /etc/apt/sources.列出.d/github-命令行工具.列出 > /dev/null sudo apt 更新 sudo apt 安装 gh -y
Other Linux: See: https://github.com/命令行工具/命令行工具/blob/t运行k/docs/安装_linux.md
Step 3: 配置 令牌 # Method 1: Interactive (paste when prompted) gh auth 记录in --with-令牌 # Then paste your 令牌 and press Enter
# Method 2: One-line (replace YOUR_令牌) echo "ghp_YOUR_令牌_HERE" | gh auth 记录in --with-令牌
Step 4: 设置 Git Protocol to SSH gh config 设置 git_protocol ssh
This ensures gh commands use SSH (not HTTPS) for Git operations.
Part 3: Verification 验证 SSH Configuration # Test SSH connection ssh -T git@github.com
# Expected: Hi username! You've 成功fully 认证d...
验证 GitHub 命令行工具 # 检查 authentication 状态 gh auth 状态
# Expected: ✓ 记录ged in to github.com account username
# Test API 访问 gh API user --jq '.记录in'
# Expected: your-username
验证 Complete 工作流 # Test creating a 仓库 (will 创建 and 删除) gh repo 创建 test-auth-$(date +%s) --public --description "Test" \ && echo "✅ 创建: 成功" \ && gh repo 删除 $(gh repo 列出 --limit 1 --json name --jq '.[0].name') --yes \ && echo "✅ 删除: 成功"
All operations should complete without prompting for passwords.
🔄 Convert Existing Repos to SSH
If you have existing repositories using HTTPS URLs:
# 检查 current remote git remote -v
# If it shows https://github.com/... # Convert to SSH git remote 设置-url origin git@github.com:username/repo.git
# 验证 git remote -v # Should show: git@github.com:username/repo.git
Batch convert all repos in a directory:
find . -name ".git" -type d | while read gitdir; do cd "$gitdir/.." if git remote 获取-url origin 2>/dev/null | grep -q "https://github.com"; then REPO=$(git remote g