DEV Community

Phillip Dodd
Phillip Dodd

Posted on

How to Set Up GitHub Projects in a VS Code Workspace

How to Set Up GitHub Projects in VSC Workspace

This is written as though you do not already have a Workspace created.

Step 1: Create a local dev folder

This is simply a folder somewhere on your local machine that you save code to. You probably already have one. Once you've created it, return to VSCode and click File > Add Folder to Workspace... and select your folder that you want to work from.

It is my personal preference to also create a folder called local within this folder to stash random files.

This will serve as a base for your Workspace (as I am currently unaware of a way to create a Workspace from scratch.)

Step 2: Create a local GitHub folder

This step is not required, I just prefer it for organizational purposes. Feel free to skip this step, name the folder something different or add additional folders within it before cloning any projects*

If this does not already exist on your machine, create a folder somewhere (I personally created it in my Documents directory on my Windows machine) and name it GitHub.

Now, return once more to VS Code and click File > Add Folder to Workspace..., selecting your newly created GitHub folder.

Step 3: Save your Workspace

VS Code will typically use the last workspace you had loaded as default when it loads up, but there have been a time or two when I was thankful I had taken the time to save my workspace settings.

You can save this by selecting File > Save Workspace As... in the menu.

Step 4: 'Open in Terminal' the GitHub folder

By right clicking the GitHub folder in the Explorer sidebar, you can click the option in the resulting menu Open in Terminal to make Visual Studio Code's integrated Terminal open up with the prompt location already set to the folder you clicked.

On occasion, I've noticed this will be a directory level up from what I anticipated, so it's always important to double check the location and make adjustments via cd if necessary.

Step 5: Git Clone All the Things

Now that you've got this terminal open, it's a simple matter of using the git clone command using the clone URL from the project your wanting to clone! I've included a few links below in case you need any additional help with cloning the desired repository or using version control in VS Code.

Resources:

Lastly,

Thank you for taking the time to check out this guide. If you have any constructive criticism or suggestions on the content or style of this article, I encourage you to share it with me, as I am always seeking to improve my communication skills! :)

Discussion (0)