Skip to content

Connect GitHub to VS Code

Check that Git is installed:

Fenêtre de terminal
git --version

Set your identity (same information as on GitHub):

Fenêtre de terminal
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Set VS Code as the default editor:

Fenêtre de terminal
git config --global core.editor "code"

Create a new SSH key pair:

Fenêtre de terminal
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"

You get two files in ~/.ssh/:

  • id_rsa → private key (keep it secret)
  • id_rsa.pub → public key (share with GitHub)

  1. Copy the public key:
Fenêtre de terminal
cat ~/.ssh/id_rsa.pub
  1. Go to GitHub → Settings > SSH and GPG keys > New SSH Key
  2. Paste the key, give it a name, save.

Start the SSH agent and add the key:

Fenêtre de terminal
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

  • Open VS Code
  • Install the GitHub Pull Requests and Issues extension
  • Click bottom left on Sign in to GitHub
  • Authorize access to your GitHub account

In VS Code:

  1. Ctrl + Shift + P → type Git: Clone
  2. Paste the SSH URL of the repository:
Fenêtre de terminal
git@github.com:user/my-project.git
  1. Choose a folder → VS Code opens the project automatically.

  • Source Control tab (branch icon in the sidebar)
  • Main steps:
    1. Stage (+) = git add
    2. Commit (message required) = git commit -m "Message"
    3. Sync Changes (↑↓) = git push / git pull

  • Always create a branch per feature (feature/login, fix/bug).
  • Make frequent commits with clear messages.
  • Use a .gitignore to skip unnecessary files.
  • Always pull before starting to code.