Install Git and Github in VSCode

Share this post

This post is part of the complete guide on Git and Github

The first step to being able to use Github with VSCode is to set-up Git on your computer and enable in it VSCode. This post will show you easy steps to set-up Git and Github in VisualStudio Code.

  1. Understand what are Git, Github and VSCode
  2. Install Git on Your Computer
  3. Enable Git in VS Code
  4. Create Your Github Account
  5. Configure Your Login

1. Understand the Basics

Visual Studio Code (VSCode) is a code editor to develop, run and debug code.

Git is the tool that lets you create a local repository (on your PC) and manage versions of your files.

Github is an online service that will host your Git repositories (in the cloud).

2. Install Git on Your Computer

In the official documentation on Visualstudio, it says that you need to install Git before you can access from VSCode.

To see if Git is already installed, you can go in the command line (on Windows) , or in the terminal (on Mac) and type this command.

$ git --version
git version 2.20.1.windows.1

If it is not installed however, just go to Git-SCM and download the executable file for your machine.

3. Enable Git in VS Code

To enable Git in VS Code on Windows:

  • Go to File > Preferences
  • Go to Settings
  • Type Git: Enabled in the search bar
  • Make sure that the box is ticked

To enable Git in VS Code on Mac:

  • Got to Code > Preferences
  • Go to Settings
  • Type Git: Enabled in the search bar
  • Make sure that the box is ticked
Enable Git in Visual Studio Code
Enable Git in Visual Studio Code

4. Create or Sign-In Your Github Account

To create an account on Github, go to github.com and follow the steps to create an account.

Create an account on Github
Create an account on Github

5. Configure Your Login

It is now time to set-up your commit email address in Git.

To configure your Git Login, we will need to set your username and email address in Git.

To do so, open the terminal.

Set username in Git.

git config --global user.name "yourusername"

Set an email address in Git.

git config --global user.email "[email protected]"

Add the email address to your GitHub account.

If you use two factors authentication (2FA) in your organisation, you will need to generate an access token. You can also read the official documentation to help you.

Conclusion

That’s it VSCode is configured with Git.

Next steps?