git init Command
The git init command is used to create a new Git repository in a directory.
By executing git init
in a directory, you can create a Git repository.
For example, let's create a project named tutorialpro in the current directory:
Example
$ mkdir tutorialpro
$ cd tutorialpro/
$ git init
Initialized empty Git repository in /Users/tianqixin/www/tutorialpro/.git/
# Initialized an empty Git repository.
Now you can see a .git
subdirectory generated in your project, which is your Git repository. All snapshot data for your project is stored here.
.git
is hidden by default and can be viewed with the ls -a command:
ls -a
. .. .git