To initialize a Git repo, enter the following command in your terminal inside a project folder:
Before using the above command, make sure you’ve navigated to the correct project folder using the
git init command will create a new directory inside your project folder called
.git. Since it starts with a period, it is a hidden folder and may not appear inside your text editor or in your file explorer program (it’s possible to change your text editor or OS settings to make it visible, however).
To check that the
.git directory was created, enter the following command in your terminal:
This command will list all of the files and folders in your project folder, including any hidden files and directories. The
.git directory should be listed in the output.
Use the command in the Summary to initialize your project repository.
Pro Git book on the official Git website (see the section called “Initializing a Repository in an Existing Directory”)