git init --Initialize Git repository

Use the "git init" command to initialize the Git repository.

git init

This is a sample to initialize a directory called perlzemi as a Git repository. Use the cd command to change to the "perlzemi" directory and then run the "git init" command.

cd perlzemi
git init

Initialization will create a directory called ".git".

.git

The ".git" directory stores Git settings for this repository and Git commit information.

Create a raw Git repository that is not a working directory

To create a raw Git repository without a working directory, use the "--bare" option of "git init".

I don't think you need to create a raw Git repository (only the directory that corresponds to .git) if you use it as a developer, but if you develop a repository management web interface like Github, you have a working directory. You may create a Git repository that doesn't exist.

mkdir foo.git
cd foo.git
git init --bare

Associated Information