How to Git- Create repository & Add files

In this guide, we are going to learn how to create a Git project by creating a repository directory and adding files to it. A Git repository is a directory that contains the history of a collection of files starting from a certain directory.
Let’s dive into creating repository in detail.

Create a Git repository

On the windows system, Git home directory is C:\Users\username folder. To create a new repository on the home directory inside the repository, create an empty directory. The following example will create an empty directory named “Lauyou” using mkdir command and create a file first.txt file in it.

Git Bash

mkdir Lauyou
cd Lauyou
touch first.txt

Now you have a directory that contains a file. Run the git init in order to create a git repository from that directory.