VS Code

How to Connect VSCode to GitHub Easily

How to Connect VSCode to GitHub Easily

Most of the work happens outside the editor. You install Git locally, you have a GitHub account, and the first time you clone a private repository or push something, VS Code opens a browser tab so you can sign in. For most people that’s the entire setup.

A lot of tutorials start by installing an extension anyway. The VS Code documentation (revision dated 10/28/2026) states that Git operations need no extension to authenticate with GitHub, although Microsoft’s Learn training module begins with an extension install. The GitHub Pull Requests and Issues extension only becomes relevant once you want pull requests and issue tracking inside the editor.

Something that trips people up early: the name and email set with git config identify the commit author. They do not sign you in.

What do you need before connecting VSCode to GitHub?

Start with Git itself. VS Code does not carry its own Git. It uses the Git installation on your machine for Git operations, so the editor is only as connected as that install.

After that you need a GitHub account and a commit identity, both covered below.

GitHub is a separate layer on top of Git. If the split between the two is fuzzy, this explainer on how Git and GitHub differ clears it up.

Git works fine locally with no account at all. Publishing changes is where a GitHub hosting account becomes required, and the same goes for creating pull requests or managing issues.

Install Git

Check first, because it may already be there. Open a new terminal inside VS Code (Terminal, then New Terminal) and run git –version.

Command not found? Install Git and restart VS Code so it picks up the new install.

PlatformInstall routeWorth knowing
WindowsGit for Windows installer from git-scm.comBundles Git Credential Manager
macOSHomebrew (brew install git)Homebrew must already be installed
LinuxDistro package manager (sudo apt install git on Debian and Ubuntu)Command and package name vary by distro

GitHub’s own setup guide sends you to git-scm.com for the latest installer. Windows users get a small bonus here, since Git for Windows includes Git Credential Manager, which the VS Code FAQ names as the recommended credential helper.

Per-system walkthroughs live in this guide on installing Git.

Set your commit identity

Run these once per machine:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

These values identify the commit author and are not sign-in credentials. If you drop –global, the value applies to one repository only, which is handy when work and personal projects live on the same laptop.

Pay attention to the email. GitHub uses the email in your local Git configuration to link pushed commits to your account, and the address must be added and verified on the account to count toward your contributions graph. I’ve watched people push for weeks with a typo in that address and wonder why their graph stayed empty.

If you’d rather keep your real address private, a GitHub-provided noreply address works too.

How do you sign in to GitHub from VSCode?

YouTube player

You don’t go looking for a sign-in button. Start any action that needs GitHub, such as cloning a private repository or pushing, and VS Code opens a browser sign-in on its own. You follow the browser steps, then return to VS Code.

That browser flow is the documented main route (VS Code documentation, revision dated 10/28/2026).

  1. Open the Command Palette (Ctrl+Shift+P on Windows and Linux, Shift+Cmd+P on macOS) and run Git: Clone, or start a push from the Source Control view.
  2. Pick Clone from GitHub, or let the push proceed, and accept the sign-in option when VS Code asks.
  3. Log in to GitHub in the browser tab that opens and approve Visual Studio Code.
  4. Switch back to VS Code. The clone or push carries on with your account.

Sometimes the redirect back to the editor just doesn’t happen. A manual fallback is documented for signing in through the GitHub Pull Requests and Issues extension: select “Signing in to github.com…” in the Status Bar, paste the authorization token, and press Enter.

Do you need a GitHub extension?

For Git operations, no.

The VS Code documentation states that you don’t need an extension to authenticate Git operations with GitHub.

Tutorials often say otherwise, and Microsoft’s Learn module is a good example. It starts by installing the GitHub Pull Requests and Issues extension, but that’s because the module is built around that extension, not because Git needs it.

The Pull Requests and Issues extension is the one to get if you want to create and review pull requests or manage issues without leaving the editor. You sign in to it from the GitHub icon in the Activity Bar.

GitHub Repositories is a different thing entirely. It lets you browse, edit and commit to repositories as virtual workspaces.

The two extensions are separate, so install only the one you need. Both come from the Extensions view, and this overview of VS Code extensions covers how installs work.

How to clone a GitHub repository in VSCode

Run Git: Clone from the Command Palette, enter the repository URL or choose Clone from GitHub, then pick a local folder. Sign in if prompted, and optionally open the clone in a new window.

The Command Palette (Ctrl+Shift+P or Shift+Cmd+P) works from anywhere. If no folder is open, the Source Control view also shows a Clone Repository button that does the same job.

Clone from GitHub is the option I use most. It lists your own repositories, so you pick one instead of hunting down and pasting a URL.

A longer walkthrough sits in this guide to cloning a GitHub repository.

Keep in mind that cloning does not give you write access. Pushing needs write permission or a fork.

Cloning without a local copy

The GitHub Repositories extension opens a repository as a virtual workspace. Nothing lands on disk.

The nice part is that commits go straight to GitHub, with no separate push step. But tasks, debugging and the integrated terminal don’t work there, so terminal, build and debug workflows need a local clone or another environment.

For anything beyond quick edits, clone. Fewer surprises.

How to publish a local project to GitHub from VSCode

Run Publish to GitHub from the Command Palette, name the repository, and choose public or private. VS Code then creates the GitHub repository, adds it as a remote, and pushes your commits.

A folder without Git needs one step first. Initialize Repository turns it into a local repository with no commits, and nothing is uploaded, which is the same job as what git init does in the terminal.

  1. Open the project folder with File, then Open Folder.
  2. Open the Source Control view (Ctrl+Shift+G on Windows and Linux) and select Initialize Repository, or run Git: Initialize Repository from the Command Palette.
  3. Stage your files and commit them with a message.
  4. Run Publish to GitHub and sign in if prompted.
  5. Enter an available repository name and choose public or private.
  6. If VS Code asks which files to include in the initial commit, select them and confirm.

I default to private for anything half-finished, and plenty of people do the same. GitHub’s Octoverse 2025 report found 81.5% of contributions happened in private repositories, while 63% of all repositories were public.

Add a remote manually

Publish to GitHub creates a new repository. If an empty one already exists on GitHub, add it as a remote instead.

In the Source Control view, open More Actions, then Remotes, then Add Remote, or run Git: Add Remote from the Command Palette. Paste the repository URL and name it origin, the conventional name explained in this note on what origin means in Git.

ActionUse it whenWhat happens
Publish to GitHubNo GitHub repository exists yetCreates the repository, adds the remote, pushes commits
Add RemoteAn empty repository already exists on GitHubSaves the URL only, uploads nothing
Publish BranchA remote is already setUploads a branch to that remote

Adding a remote does not upload commits or set an upstream branch. Run a push afterward.

What if you cannot push to the repository?

Signing in does not grant write permission to every repository. If it’s someone else’s project, fork it on GitHub, do your work in the fork, and open a pull request back to the original when you’re ready.

When VS Code asks which remote to use, pick one you can push to, such as your fork.

Browser sign-in, personal access token or SSH key: which should you use?

Browser sign-in, unless something specific rules it out. On GitHub Enterprise Server, a personal access token is the documented route. A machine with no usable browser also pushes you elsewhere, and if your workflow is already built on SSH there’s no reason to change it.

MethodSetup effortBest forFailure mode
Browser sign-inOne promptgithub.com accountsNeeds a browser on the machine
Personal access tokenCreate, scope, storeEnterprise Server, HTTPSToken expires
SSH keyGenerate, load, uploadExisting SSH workflowsPermission denied (publickey)

Personal access token

GitHub recommends fine-grained tokens whenever possible and classic ones only when a needed feature requires them. The practical difference is reach. Fine-grained tokens can be limited to specific repositories, while classic tokens cover every repository you can access.

If you do go classic for command-line access, the token needs the repo scope.

Where the token goes is a little odd the first time. For private repositories Git asks for a username and password, and the token goes in the password field.

Fine-grained tokens default to a 30-day expiration, according to GitHub Docs. A push that worked last month can fail this month for that reason alone, and the error message won’t tell you so.

Plain account passwords are out: GitHub’s documentation says password-based authentication for Git has been removed. Creation steps are in this guide on getting a GitHub token.

SSH key

SSH skips tokens entirely and costs more setup.

  1. Generate a key with ssh-keygen -t ed25519 -C "your_email@example.com". Use RSA 4096 only for systems that lack Ed25519 support.
  2. Set a strong passphrase, then load the key into ssh-agent so the passphrase is not requested every time.
  3. Add the public key (the .pub file, not the private one) to your GitHub account.
  4. Switch the remote to the SSH form of the URL, such as git@github.com:user/repo.git.

Keys belong to one computer, so each new machine needs its own key. This walkthrough on adding an SSH key to GitHub covers the upload screen.

The usual way this breaks is a blocked port 22, common on office and hotel networks. GitHub’s docs point to SSH over the HTTPS port as a workaround.

Credential helpers and GitHub CLI

For HTTPS, GitHub recommends GitHub CLI or Git Credential Manager to remember your credentials, and it ranks neither above the other.

Git Credential Manager handles 2FA, so you never create a token by hand. On macOS it installs through Homebrew and keeps credentials in the keychain. Linux needs a separate install.

With GitHub CLI, gh auth login stores your Git credentials when you pick HTTPS as the protocol.

On Windows, GitHub’s docs set the floor at Git for Windows 2.29, the first version with GitHub OAuth support. Older credential manager versions are unsupported.

How to push, pull and sync changes once VSCode is connected

Stage, commit, then push. A commit records the snapshot in local Git history and does not upload it, so nothing reaches GitHub until the push.

To stage a file, hover it under Changes and select +, which moves it to Staged Changes. Then type a message in the box at the top of the Source Control view and select Commit.

Push uploads your commits and Pull brings remote commits into your branch. Sync Changes pulls before pushing, and the Status Bar sync icon runs the same action.

Sync Changes is fine on a solo branch. On a shared one I’d pull first and read what arrived before you push. This note on what git pull does explains the mechanics.

Push, Pull, Fetch and Remotes all sit under the More Actions menu in the Source Control view.

One annoyance to know about. With git.autofetch turned on, background fetches can trigger repeated sign-in prompts. Turning it off stops those prompts but does not fix credentials that manual operations need.

Open a pull request from the editor

This is where the GitHub Pull Requests and Issues extension earns its install. It creates and reviews pull requests and manages issues.

The githubPullRequests.queries setting controls which pull requests appear in the list. The GitHub-side steps are in this guide to creating a pull request in GitHub.

How to check the connection and fix common errors

A small test push tells you more than any settings screen. Before that, a couple of quick checks help narrow things down.

Check that the connection works

Run git remote -v to print the origin address. An https:// address means token or credential helper, and git@github.com means SSH.

The Accounts menu in the Activity Bar lists the signed-in GitHub username, which is worth a glance if you have more than one account.

SSH users can run ssh -T git@github.com. It answers with a Hi USERNAME greeting when authentication works.

Then do a real push of one small commit. Read access can look healthy while write access is missing.

Fix common errors

Open the Git Output window first. It lists the executable paths VS Code tried, and for hung operations it shows the authentication error behind them.

ErrorCauseFix
Git not foundVS Code cannot locate a Git executableRun git –version, install Git, restart VS Code, then set git.path to the full executable path if needed
Authentication failedWrong account or stale credentials in the credential helperOn Windows, delete the GitHub entry in Credential Manager and sign in again
Permission denied (publickey)No key loaded, public key missing from the account, wrong username, or sudo in the commandCheck ssh-add -l against your account’s keys and test with ssh -T git@github.com
Repeated or hanging promptsNo credential helper configuredConfigure Git Credential Manager and retry the operation

When does the built-in VSCode GitHub connection fall short?

Mostly with GitHub Enterprise and custom domains, and on shared machines. Some work also just fits better in a cloud environment or a different client.

Enterprise and custom GitHub domains

The documentation doesn’t fully agree with itself here. Microsoft’s Azure developer documentation says VS Code assumes github.com by default, so a custom domain such as an enterprise host needs extra configuration.

VS Code’s own FAQ is simpler about it: open a local checkout of the Enterprise Server repository and follow the sign-in prompt. The Pull Requests extension is the exception, since it needs configuring for your server first.

Managed accounts add a wrinkle. Enterprise Managed Users may need account filtering switched off in Git Credential Manager with git config –global credential.gitHubAccountFiltering “false”.

Shared and locked-down machines

Cached credentials belong to the operating system login. Windows keeps them in Credential Manager and macOS in the keychain, so a shared login shares push access.

On those machines, sign out and clear the stored entry when you finish.

Alternatives and when each fits

ToolFits whenCatch
GitHub DesktopYou want a visual Git client outside the editorSeparate app and separate sign-in
GitHub CLIYou want one terminal sign-in that also feeds GitPick HTTPS to store Git credentials
GitHub CodespacesYou want no local Git setup at allFree quota is capped

Some people never warm up to the Source Control view, and a graphical client suits them better. What GitHub Desktop does is covered in its own guide.

Codespaces runs VS Code in the browser or on the desktop inside a hosted environment. Personal Free accounts get 120 core hours and 15 GB-month of storage a month, which works out to 60 hours on a 2-core machine, according to GitHub Docs.

That free use is included in personal accounts only, not in organization or enterprise accounts. If you are weighing it, this explainer on what GitHub Codespaces is is the next stop.

VSCode GitHub Connection FAQ

How do you sign out of GitHub in VSCode?

Select the Accounts button in the Activity Bar, pick the GitHub account, and choose Sign Out. That ends the editor’s GitHub session only. Credentials stored by your credential helper live separately.

Can you switch to a different GitHub account in VSCode?

Yes. Sign out first, then clone or push to trigger a fresh browser sign-in with the other account.

Update user.name and user.email as well, because the commit identity does not follow the sign-in. If pushes still use the previous account, clear the old GitHub entry in your credential helper.

How do you revoke VSCode’s access from GitHub?

On GitHub, open Settings, choose Applications under Integrations, and select the Authorized OAuth Apps tab. Click the three-dot icon beside the Visual Studio Code entry and select Revoke.

The next clone or push needs a new sign-in.

Is a free GitHub account enough?

For this, yes. GitHub Free for personal accounts includes unlimited private repositories and unlimited collaborators, although private repositories get a limited feature set.

Does the setup differ on Windows, macOS and Linux?

Barely. VS Code installs on all three systems, and the sign-in, clone and publish steps match.

The differences sit outside the editor, in how Git gets installed and where credentials are stored. Keyboard shortcuts swap Ctrl for Cmd on macOS.

Does connecting to GitHub also turn on Copilot?

No, Copilot has its own step. Hover over the Copilot icon in the Status Bar, select Use AI Features, and follow the sign-in prompts.

Without a subscription you land on the Copilot Free plan. An existing subscription on your account is reused.

How to Keep the VSCode GitHub Connection Working

Browser sign-in plus a credential helper is the setup that breaks least. Git Credential Manager handles 2FA and removes manual token creation, so there’s very little to maintain. I’d only bring in a token or an SSH key when some constraint forces it.

The reason for that order is upkeep. GitHub recommends an expiration on every token, and a key needs one upload for each computer.

A personal access token carries a second limit: GitHub automatically revokes tokens left unused for one year. A laptop that sits idle that long needs a fresh sign-in.

This order reflects VS Code and GitHub documentation read on 11/20/2026. If VS Code changes its built-in GitHub authentication, it’s worth revisiting.

Once the connection holds, the next step is a repeatable Git workflow for branches and pull requests.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.