Sign in to GitHub from Windows

safe beginner #auth#github#login#token

When to use this: Git asks for a password and rejects it, or you need to push for the very first time.

Before you start

Steps

  1. Easiest: let Git Credential Manager do it

    terminal
    git push

    Git for Windows ships with Git Credential Manager. The first time you push to a GitHub HTTPS URL, a browser window opens, you sign in once, and Windows remembers the login.

    If no window appears, use the GitHub CLI option in the next step.

  2. Alternative: GitHub CLI

    terminal
    gh auth login

    Choose GitHub.com, HTTPS, then 'Login with a web browser'. Follow the one-time code. Install the CLI first from cli.github.com if the command is missing.

  3. Check who you are signed in as

    terminal
    gh auth status

    Shows the account and which protocol is used.

    Expected output
    github.com
      ✓ Logged in to github.com account yourname (keyring)

How to verify it worked

  • gh auth status shows your account, and git push completes without asking for a password.

How to undo it

Sign out of the GitHub CLI:

terminal
gh auth logout

To clear a wrong saved Git login, open Windows 'Credential Manager', then 'Windows Credentials', and remove the entry for git:https://github.com. Git will ask you again.

Common errors and fixes

remote: Support for password authentication was removed You typed an account password. Use the browser sign-in (Credential Manager or gh auth login) or a personal access token instead.
Permission denied (publickey) Your remote uses an SSH URL but no key is registered. Either add an SSH key to GitHub, or switch the remote to HTTPS: git remote set-url origin https://github.com/USER/REPO.git.
fatal: Authentication failed after changing GitHub password or token Remove the old saved credential in Windows Credential Manager (see Undo) and sign in again.

Q&A

HTTPS or SSH, which should I use?

HTTPS with Git Credential Manager is the simplest on Windows. SSH is fine if you already use keys. Both work with Vercel because Vercel connects through the GitHub app, not your keys.

Does signing in on my PC give Vercel access to GitHub?

No. Vercel is authorised separately, from the Vercel dashboard, by installing its GitHub app on your account or repository.

Practice these as flashcards →

Terms in this scenario

Related scenarios

My notes

Saved in this browser only.