Initialize Git repository

Let's create a Git repository. The first task you need to do when managing a repository in Git is to initialize the repository.

Let's say the directory of the project where the source code is located is "myapp".

mypp / foo.pl
    /bar.pl
    /baz.pl

To manage this directory as a Git repository, initialize it using the git init command.

Change to the "mypp" directory with the cd command.

cd mypp

Then run the "git init" command.

#Initialize Git repository
git init

If successful, the following message will be output.

Initialized empty Git repository in /home/kimoto/labo/myapp/.git/

If you specify the "-a" option with the ls command and display the hidden directory, it will be ".git". There is a directory called.

$ls -a
... foo.txt .git

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

Be careful not to edit the contents of the ".git" directory directly unless you have a specific reason to do so.

This completes the work of initializing the Git repository.

Associated Information