To create a repository from an existing folder you need to enter the following command in your terminal:

$mkdir HelloWorld
$cd HelloWorld
$git init

First command is to create a new folder called HelloWorld, then change directory to HelloWorld. Now inside the HelloWorld folder we enter the command git init to initial the repository.

After the repository have been initialised Git will place all the revision information into a hidden folder called .git, so now we have a new local repository.