Skip to content

GitHub Remotes and Auth

Remote Basics

A remote is a named link to another copy of the repository, usually on GitHub.

git remote -v
git remote add origin https://github.com/ijk37/git-github.git
git push -u origin main

After the upstream is set, normal pushes are simple:

git push
git pull --ff-only

HTTPS and SSH

Method Notes
HTTPS Common, works well with credential helpers and tokens
SSH Useful for frequent GitHub use and key-based authentication

Authentication Habits

  • Never paste a personal access token into a repo file.
  • Treat tokens like passwords.
  • Give tokens the smallest permission scope possible.
  • Rotate tokens if a machine is lost, shared, or compromised.