Check Remote Repositories

git remote -v

Add, Change, or Remove a Remote

git remote add origin URL
git remote set-url origin URL
git remote remove origin

fetch vs pull vs push

git fetch origin        # Download remote changes (no merge)
git pull origin main    # fetch + merge
git push                # Push local commits to remote
git push -u origin main # Push and set upstream branch

Common Pitfalls

  • Never use git push --force on a shared repository
  • The -u flag sets the upstream so future git push works without arguments

If you’re using SSH for GitHub authentication, set the remote URL to the SSH format. See Generate an SSH Key and Add It to GitHub.

  • Fiverr - Find freelance developers and tech experts