Retrieving a project with Git in VS Code
I recently bought a new laptop and of course the first thing I start to do is set up my development environment. I have pretty much always used Visual Studio for development purposes, even when editing a basic HTML site since they make it so easy to just push the changes thru the IDE to Azure websites. I know it’s a little bloated, but it is very easy. At my last job we started playing around with VS Code so I decided I would give it a whirl. The first step is to obviously make sure you have Git installed, but I will not go into that in this post.
After installing my plugins, I thought I could just go to the source control activity and I would be provided with options but found that I had none. As you see below the message is “There are no active source control providers.” This was kind-of-misleading to me since I had Git installed.
Here is where you have two options to get started. You can open a command window or terminal and navigate to the folder where you want the project to be located and do your typical git clone, as shown below.
git clone https://gitlab.com/myrespository/myproject
Once this is done you can open the folder in VS Code and everything will be hooked up as you expect. However, there is a way inside of VS Code. It’s just not where I thought it would be. At the bottom of the screen you might already see the terminal option. If not, go to the Top Menu -> View -> Integrated Terminal or Ctrl` on Mac or Ctrl+ on Windows.
Once the terminal is up inside of VS Code, you can do the same thing you did above by navigating to the folder you want your project in and then doing the git clone command. This way, you can accomplish loading your project within the built in terminal without having to leave the IDE.
It’s pretty simple really and now you have your terminal right in the project. For some reason I just thought there would be an easy button.