Every Developer Hits This Wall

You clone a repo. You make a commit. You git push — and GitHub wants credentials. Maybe it asks for a password (which no longer works — GitHub killed password auth in 2021). Maybe it throws fatal: Authentication failed. You Google “git push permission denied,” and 20 minutes later you’ve got three Stack Overflow tabs open.

There’s a clean way through this — three of them, actually. This is what the github-auth skill automates under the hood, broken down here with exact commands you can run right now.

The Three Methods, Explained Simply

  • HTTPS with a Personal Access Token (PAT) — paste a token once, git stores it, you never think about it again. Most portable; works anywhere git runs.
  • SSH key authentication — generate a keypair, upload the public half to GitHub, every push is signed silently. Set-and-forget for permanent machines.
  • GitHub CLI (gh) — one gh auth login opens a browser, you click “authorize,” and you’re authenticated and git is configured in one shot. Does everything.

All three get you to the same place: git push just works.

Method 1: HTTPS with a Personal Access Token

Best for quick setup on any machine — no SSH config, no extra software.

Step 1 — Create the token: Go to github.com/settings/tokens, click “Generate new token (classic)”, name it, and select scopes:

  • repo — full repository access (read, write, push, PRs)
  • workflow — trigger GitHub Actions
  • read:org — if you touch org repos

Set expiration to 90 days. Copy the token — GitHub won’t show it again.

Step 2 — Tell git to store it:

git config --global credential.helper store

Step 3 — Trigger auth once:

git ls-remote https://github.com//.git
# Username: your-github-username
# Password: 

Credentials are now saved — every future push, pull, and fetch is silent.

Method 2: SSH Key Authentication

Best for permanent machines — your dev workstation, a long-lived server. The key signs every push automatically.

Step 1 — Generate a keypair (ed25519 is modern default):

ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519 -N ""

Step 2 — Upload the public key: Copy the output of cat ~/.ssh/id_ed25519.pub, go to github.com/settings/keys, click “New SSH key”, paste it.

Step 3 — Test the connection:

ssh -T [email protected]
# Hi ! You've successfully authenticated...

Step 4 — Make git rewrite HTTPS URLs to SSH so old clone URLs keep working:

git config --global url."[email protected]:".insteadOf "https://github.com/"

Done. Every GitHub operation now uses SSH silently.

Method 3: GitHub CLI Authentication

Best when you want everything — git credentials and API access — in one command. Requires the gh CLI.

Step 1 — Log in via browser:

gh auth login
# Select: GitHub.com → HTTPS → Authenticate via browser
# A one-time code appears — paste it into the browser tab that opens

Step 2 — Hand credentials to git itself:

gh auth setup-git

Now both gh (PRs, issues, releases, Actions) and git (clone/push/pull) are authenticated through one login.

Which One Should You Choose?

  • Borrowed or cloud box, no SSH config?HTTPS + token. Fastest path; token lives in the credential store.
  • Permanent dev machine?SSH key. Generates once, signs silently forever, no tokens to rotate.
  • PRs, issues, Actions from the CLI?gh CLI. One login handles everything, including git.

No gh and no sudo? Fall back to HTTPS+token.

The AHA Moment

Run this after any of the three setups:

gh auth status

If you went the gh CLI route, you’ll see:

github.com
  ✓ Logged in to github.com as 
  ✓ Git operations for github.com configured as: https
  ✓ Token scopes: repo, workflow

Three green checkmarks. You clone, you push, you open a PR — no prompts, no errors, no credential hunting. That’s the moment the auth wall disappears. With HTTPS or SSH, the equivalent proof is ssh -T [email protected] saying “successfully authenticated” or a silent git push on a fresh clone.

Troubleshooting Tips

  • git push asks for password → GitHub killed password auth. Use a token as the password, or switch to SSH.
  • remote: Permission denied → Token likely lacks repo scope — regenerate with the right scopes.
  • fatal: Authentication failed → Stale cached creds. Run git credential reject then re-authenticate.
  • SSH port 22 refused → Tunnel over HTTPS: add Host github.com / Hostname ssh.github.com / Port 443 to ~/.ssh/config.
  • Credentials not persisting → Check git config --global credential.helper — must be store or cache.
  • Multiple GitHub accounts → Distinct SSH keys with host aliases in ~/.ssh/config, or per-repo credential URLs.

Conclusion

GitHub auth isn’t a mystery — it’s three menus deep and one command wide. Pick HTTPS+token for speed, SSH for permanence, or gh for everything at once. Run gh auth status at the end, see the green checkmarks, and stop fighting credential prompts. You’ve got better things to push.