Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Initialize a repo – Git


To initialize a Git repo, enter the following command in your terminal inside a project folder:

git init


Before using the above command, make sure you’ve navigated to the correct project folder using the cd command.

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:

ls -a

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”)

Back to: Git Reference > Git Setup