Creating a Git Repository in vscode

Creating a Git Repository in vscode

Creating a Git Repository in vscode

In this article, I will be walking you through setting up a local Git repository using the visual studio code editor and the command line.

Here’s what we’ll cover:

Setting up the Visual Studio Code Editor for use with Git

Creating a new project in Visual Studio Code

Initializing our project to keep track of file changes with Git (Git Init) and creating our first commit.

Setting up vscode to use Git:

Open Visual Studio Code.

Navigate to File > Preferences > Settings.

On the right panel, search for git by typing it in the search bar. Then click on Edit in settings.json. This opens your current user settings, which are stored as a JSON object. If you want to know more about JSON objects, check out this article.

Add “git.enabled”: true to your user settings file and save it. Your user settings should look like this:

“git”: { “enabled”: true }

“git”: { “enabled”: true }

“git”: { “enabled”: true }

“git”: { “enabled”: true }

I’m following the tutorial Creating a Git Repository in vscode but am stuck at the step where you are supposed to initialize the local Git repository. I did everything according to the instructions, but when I now try to execute git init, I get the error message:

fatal: Not a git repository (or any parent up to mount point /d)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I have no idea what is going wrong here. The folder is clearly marked with a blue icon and carries the name .git. What am I missing?

To set up a Git repository, you first need to create a new directory. You can do this by running the following command in your terminal:

$ mkdir name-of-your-project

Then change your working directory to the new folder with the cd command:

$ cd name-of-your-project

Next, you will add an empty file called to the project folder. This is a Markdown file where you can add information about your project, such as what it is and how it works. This is optional but highly recommended. To create a new file in the project directory, run the following command in your terminal:

$ touch

Now it’s time to add a .gitignore file to your project folder. A .gitignore file tells Git which files or folders to ignore when committing changes to a Git repository. In our case, we want Git to ignore any files that are created automatically by our text editor (in my case vscode), so run the following command to create a new .gitignore file:

$ touch .gitignore

Open your newly created .gitignore file in vscode and add this line of code:

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano. As with most other distributed version-control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server.

Like the Linux kernel, Git is free software distributed under the terms of the GNU General Public License version 2. (A briefly maintained port of Git to Plan 9 has been available since 2009.)

Git falls in the category of distributed source code management tools. Git does not rely on the central server; that is why you can perform many operations when you are offline.

In this post I will show you how to create a git repository using the Visual Studio Code editor and command line interface on Windows 10 operating

To create a local Git repository in Visual Studio code:

1. Open the Command Palette (Ctrl+Shift+P) and type Git: Create Repository.

2. Select the folder you want to turn into a Git repository, and press the Enter key.

Open Visual Studio Code

Open the Command Pallet and type Git: Clone and press enter

In the Repository URL field, enter the URL of the new GitHub repository you just created. Make sure to select your current workspace folder in the Local Path field. Once you have entered this information click Clone. Note that you can also use this flow to clone an existing repository onto your local machine.

Once cloned, open the Git window. The Git window should now show a history of commits on a master branch, a summary of files changed, added, or deleted in the commit and any associated comments.

Now that we are all set up let’s create our first commit. Click Add File (in the Git Window) and select Add to Stagings. You can now create your first comment by typing into the text box at the bottom of the Git Window. Once you have entered your comment click Commit All (to master). Voila! You have successfully created your first commit and pushed it to GitHub!

If you navigate back to GitHub you will see that your changes have been committed there as well.

Leave a Reply

Your email address will not be published.