I spend a lot of my day in VS Code, but not too much in GitHub because I don’t work on any joint projects. I do use a local Git repository for my code. It’s easy to see when others have made changes so that I can hunt them down speak politely to them about stopping.
In any case, I was watching An Introduction to Visual Studio Code and GitHub when I learned about the Remote Repositories (GitHub) extension for VS Code. You can directly edit a repository on GitHub without having to clone it locally.
Disclaimer I must confess that in the process of using Remote Repository access this week, I managed to lose/erase 6 files that I hadn’t committed, but maybe you’re more of a git savant than I am, and you’ll have no problems.
Let’s look at how to get this installed and integrated with VS Code:
- Load VS Code
- Open Extensions (CTRL+SHIFT+X)
- Search for Remote Repositories (GitHub). Install it.
- Open the Command Palette (
CTRL+SHIFT+P
) - Type in
Remote Repositories: Open Repository
- Select
Open Repository from GitHub
- You’ll be prompted to allow access to GitHub. Allow it.
- A browser window will open. Click
Continue
to authorize access to GitHub. - Sign in to GitHub. If you don’t already have an account, there won’t be any repositories for you to open in VS Code, will there?
- You should receive a ‘Success!’ webpage, with an authorization token on it.
- If your browser prompts you to Open Visual Studio Code, do so. It’ll save you the trouble of manually entering the authorization code. Once VS Code opens again, you’ll be prompted to
Allow an extension to open this URI
. Permit it, and VS Code will complete the link. - If the browser didn’t prompt, copy the authorization token. You’ll have to paste it into VS Code manually. The Command Palette field should be asking for the token, so paste it in.
- If your browser prompts you to Open Visual Studio Code, do so. It’ll save you the trouble of manually entering the authorization code. Once VS Code opens again, you’ll be prompted to
- VS Code should now be able to open your repositories directly on GitHub.