How to Add GitHub to Visual Studio Code

Visual Studio Code supports GitHub integration via its built-in Git tools and official extensions. Here’s how to connect your GitHub account to VS Code for smooth workflows.


✅ Prerequisites

  • Visual Studio Code installed
  • Git installed on your machine (check with git --version)
  • A GitHub account

Step 1: Install the GitHub Extension (Optional but Recommended)

While VS Code has native Git support, the GitHub Pull Requests and Issues extension adds enhanced features.

  1. Open VS Code
  2. Go to Extensions panel (Ctrl+Shift+X)
  3. Search for GitHub Pull Requests and Issues
  4. Click Install

Step 2: Sign In to GitHub from VS Code

  1. Click the Accounts icon in the bottom-left corner of VS Code (or open the Command Palette with Ctrl+Shift+P)
  2. Type and select “GitHub: Sign in”
  3. A browser window opens for GitHub authentication
  4. Authorize VS Code to access your GitHub account
  5. Return to VS Code once signed in

Step 3: Clone a GitHub Repository

  • Press Ctrl+Shift+P, then type and select “Git: Clone”
  • Paste the GitHub repo URL (e.g., https://github.com/username/repo.git)
  • Choose a local folder to clone into
  • VS Code will open the cloned repo automatically

Step 4: Push Local Changes to GitHub

If you have a local repo initialized:

  1. Add your remote repository if not set: git remote add origin https://github.com/username/repo.git
  2. Use the Source Control panel in VS Code to stage, commit, and push changes
  3. Use the push button or run: git push -u origin main

Step 5: Work with Pull Requests & Issues (Using Extension)

  • After installing the GitHub Pull Requests and Issues extension, you can:
    • Create and review pull requests inside VS Code
    • View and manage GitHub issues linked to your repo
  • Access these via the GitHub icon on the sidebar

Additional Tips

  • Use GitHub Authentication via SSH for passwordless push/pull operations
  • Configure Git user info with: git config --global user.name "Your Name" git config --global user.email "yo*@ex*****.com"
  • For private repos, make sure to authenticate properly (via token or SSH keys)

Summary Table

TaskVS Code Action / Command
Install GitHub extensionExtensions panel > Search “GitHub” > Install
Sign in to GitHubCommand Palette > GitHub: Sign in
Clone GitHub repoCommand Palette > Git: Clone
Add remote repositoryTerminal: git remote add origin <url>
Stage, commit, pushSource Control panel or Git commands
Manage PRs & IssuesGitHub sidebar icon (with extension)
Sharing Is Caring:

Leave a Comment