Two doors: the editor and the terminal
Before GitHub accepts a push from your computer, it needs to
authenticate you — a fancy word for "prove you're really you". And here's the
part that trips people up: there are two separate doors. Signing in to VS Code covers
everything you click inside the editor. The moment you run git push or
git pull in a terminal, that's the second door — and GitHub no
longer accepts your account password there. You'll set up both once, then never think about it again.
Sign in inside VS Code
If you don't have a GitHub account yet, sign up free at github.com. Then connect VS Code so pushing, pulling and Publish to GitHub "just work":
- In VS Code, click the Accounts icon at the very bottom-left (the little person), then Sign in with GitHub.
- A browser window opens — approve the request, and you're connected.
That's door one done. VS Code now handles credentials for anything you do through the Source Control panel. Next: the terminal.
Option A — HTTPS + a Personal Access Token
A Personal Access Token (PAT) is a long random string that acts as a password just for Git. Create one on GitHub under Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate. When Git asks for a password during a push, paste the token instead of your real password. A credential helper — a small program that stores logins for Git — saves it so you only do this once.
Remember your token after the first push
$ git config --global credential.helper manager
$ # Windows: manager macOS: osxkeychain Linux: cache or store - When VS Code is signed into GitHub it handles this for you
- You only deal with tokens when using the raw terminal
On Windows, Git Credential Manager ships with the Git installer — this line just makes sure it's switched on.
Tip: a token is a password — treat it like one. Never commit it to a repo, paste it in chat, or share it. If one leaks, delete it on GitHub and generate a fresh one.
Option B — SSH keys
An SSH key is a pair of files that proves your identity automatically — no
passwords after setup. Generate one, add the public half to GitHub
(Settings → SSH and GPG keys), then clone using the SSH URL
(git@github.com:you/project.git).
Create and copy an SSH key
$ ssh-keygen -t ed25519 -C "you@example.com"
$ # press Enter for the defaults, then copy the PUBLIC key:
$ cat ~/.ssh/id_ed25519.pub - Paste the copied key into GitHub → Settings → SSH and GPG keys → New SSH key
Only ever share the .pub (public) file. The private key — the one without .pub — never leaves your computer.
The shortcut: gh auth login
Don't fancy juggling tokens or keys by hand? Install the official GitHub CLI
(gh, from cli.github.com)
and let one command do the whole dance — it opens your browser, you click approve, and it
wires up your terminal credentials for you.
One command, done
$ gh auth login
$ # choose: GitHub.com -> HTTPS -> Login with a web browser - This is a terminal command — run it via Terminal → New Terminal
- Inside the editor, the Accounts sign-in above already covers you
This is the easiest route on a fresh machine — no manual token or key juggling.
Escape hatch: seeing the error "Support for password authentication was removed"? That's GitHub refusing your account password at the terminal door. Jump to Fix GitHub Login Errors for the step-by-step fix.
That's it — both doors open. From here on, Git talks to GitHub without asking who you are.
Up next: put the connection to work — send your commits up and bring changes down in Push & Pull.