Learn how to add a GitHub repository to VS Code and install a handy extension for managing pull requests and issues.
Virtual Studio Code, also known as VS Code, is one of the most popular Integrated Development Environments (IDEs). It’s free, works with a large number of languages, is easy to use, and offers tons of extensions to make the tool even more useful.
Another reason VS Code is a great option is that it makes it possible and easy to work with code from a GitHub repository. Not only can you add a GitHub repository, but you can also better review and manage GitHub pull requests and issues with a handy extension, called GitHub Pull Requests and Issues.
I’ll first show you how to install the extension and sign in to your GitHub account. Once that’s done, we’ll add a GitHub repository to VS Code.
SEE: Hiring Kit: Back-End Developer (TechRepublic Premium)
what you will need
The only things you’ll need for this to work is a running instance of VS Code and a GitHub account that you can log in to. I’ll be demoing with VS Code on Pop!_OS, so you’ll need to modify the Git install process to match your OS. That is all. let’s do it
How to install Git
The first thing to do is to install Git. Installing VS Code doesn’t add Git to the mix, so you have to do it manually.
To install git on an Ubuntu-based distribution, open a terminal window and issue the command:
sudo apt-get install git -y
Once the command completes, you are ready to continue.
How to install the GitHub Pull Requests and Issues extension
Open VS Code and click the gear icon in the bottom left corner. From the popup menu (Figure A), click Extensions.
In the resulting window (Figure B), write GitHuband then click Install for pull requests and GitHub issues.
Once the setup is installed, you will see a new GitHub icon in the left sidebar of VS Code. Click on that icon and you will see a Login button (Figure C).
Click Sign In and a pop-up window will open informing you that Visual Studio Code wants to sign in with GitHub. Click Allow and your default browser will open. If you’re not already signed in to your GitHub account, please do so. After successful authentication, you’ll be redirected back to VS Code, where you’ll see that the extension is now connected to your GitHub account and ready to use (Figure D).
How to add a specific GitHub repository to VS Code
Now, we will add a GitHub repository to VS Code. You’ll need to go back to your GitHub account using your default browser and locate the repository address you want to add. Once you’ve navigated to the repository in question, click the Code dropdown menu and copy the HTTPS URL (Figure E).
Go back to VS Code and click the source code control icon in the left navigation menu (third from the top). In the source control window (Figure F), click Clone repository.
You should now see an address bar at the top of the VS Code window (Figure G).
Paste your repository address into that address bar and press Enter on your keyboard. You will then be prompted to select a local repository location. For this, simply locate a directory in the file manager popup window to host the source.
Once you’ve done that, your default web browser will open again and ask you to authorize VS Code access to the account. When prompted, click Authorize Visual Studio-Code, which will take you back to VS Code, where you need to tell the app that you trust the authors (Figure H).
You should then see the VS Code Explorer open to show the files found in the repository (figure i).
Congratulations! You’ve just connected VD Code to both your GitHub account and a GitHub repository. This excellent IDE just got even better.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube to get the latest tech tips for business professionals from Jack Wallen.