How to Sign In to GitHub from VS Code

Sign in to GitHub from VS Code so you can clone private repositories, push commits, and manage pull requests without leaving the editor. Authentication is built into VS Code and works through your browser.

5 min read

VS Code has built-in GitHub authentication that works through your browser. You do not need an extension to sign in, and you do not need to copy tokens manually.

Once authenticated, you can clone private repositories, push commits, and create pull requests without typing your password again. VS Code stores your credentials securely in your operating system's credential manager.

This is separate from configuring your Git name and email. If you have not done that yet, start with /vscode/how-to-set-up-git-in-vs-code-and-configure-your-name-and-email.

Sign in to GitHub

The sign-in flow opens your browser, asks you to authorize VS Code, and sends you back to the editor. You do not need to copy tokens manually.

Trigger authentication

Authentication is triggered automatically when you perform an action that needs GitHub access.

Common triggers include cloning a private repository, pushing commits, or selecting Clone from GitHub in the Source Control view.

You can also sign in proactively: open the Command Palette and run GitHub: Sign In.

Authorize in your browser

Your browser opens a GitHub authorization page. Review the permissions VS Code requests and click Authorize Visual Studio Code.

Return to VS Code

After authorizing, your browser redirects you back to VS Code. A notification confirms that you are signed in. The Status Bar may show your GitHub username briefly.

If the browser redirect does not work (some browsers or network setups block it), copy the authorization token shown in the browser. In VS Code, select Signing in to github.com... in the Status Bar, paste the token, and press Enter. This fallback works the same way.

Where to see your sign-in status

After signing in, you can confirm your status in two places:

  • The Accounts menu in the Activity Bar (the person icon at the bottom left) lists your signed-in GitHub account. Select it to manage your account or sign out.
  • The Source Control view shows your GitHub username when actions like Clone from GitHub list your repositories.

What built-in authentication unlocks

Once signed in, you can do these things without typing a password or token again:

ActionWhat it enables
Clone private repositoriesThe Git: Clone command and Clone from GitHub show your private repos alongside public ones.
Push commitsPush to any GitHub repository you have write access to without re-entering credentials.
Pull from private reposPull changes from repositories you have access to.
Create and manage remotesAdd GitHub remotes without separate authentication steps.

VS Code stores your credentials securely using your operating system's credential manager: Windows Credential Manager on Windows, Keychain on macOS, and libsecret (or git-credential-libsecret) on Linux.

Sign in with a personal access token (GitHub Enterprise Server)

Signing in with a personal access token (PAT) is supported only for GitHub Enterprise Server. When the browser authentication starts, select Cancel on the sign-in prompts until VS Code asks for a token. Paste your PAT and press Enter.

Personal access tokens must have the repo scope for private repository access and the read:user scope for user information. Create tokens at github.com/settings/tokens or your Enterprise Server instance.

GitHub Pull Requests extension

Built-in authentication handles the basics. For pull request and issue management inside VS Code, install the GitHub Pull Requests extension (publisher: GitHub). It handles both pull requests and GitHub issues in the same view. This extension adds:

  • A dedicated GitHub view in the Activity Bar (hover icon)
  • Pull request creation, review, and merge
  • Issue browsing and management
  • @-mention and #-issue suggestions in comments and commit messages

The extension uses the same authentication session you already set up. You do not need to sign in again.

After authenticating, you are ready to /vscode/how-to-clone-a-github-repository-in-vs-code or /vscode/how-to-initialize-a-git-repository-and-publish-it-to-github-from-vs-code.

Rune AI

Rune AI

Key Insights

  • VS Code prompts you to sign in to GitHub the first time you perform an action that needs authentication.
  • Sign-in happens through your browser; you are redirected back to VS Code automatically.
  • Built-in authentication works without any extension. The GitHub Pull Requests extension adds extra features.
  • VS Code stores your credentials in your operating system's secure credential manager.
  • You can sign out anytime with the GitHub: Sign Out command.
RunePowered by Rune AI

Frequently Asked Questions

Do I need a GitHub account to use Git in VS Code?

No. Git works locally without GitHub. You only need a GitHub account to interact with repositories hosted on GitHub, such as cloning private repos, pushing commits, or creating pull requests.

How do I sign out of GitHub in VS Code?

Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P), run the **GitHub: Sign Out** command, and confirm. This removes your GitHub session from VS Code.

Can I sign in to multiple GitHub accounts at once?

VS Code supports signing in to one GitHub account at a time through built-in authentication. For multiple accounts, you can configure SSH keys with separate host entries in your `~/.ssh/config` file.

Is my GitHub token stored securely?

Yes. VS Code uses the credential manager built into your operating system (Windows Credential Manager, macOS Keychain, or Linux libsecret) to store authentication tokens securely.

Conclusion

Signing in to GitHub from VS Code gives you access to private repositories, lets you push commits without typing credentials repeatedly, and unlocks pull request and issue management directly in the editor.