Initializing a new git repository is as simple as
- open a terminal,
- create a new directory or go to an existing directory,
- run
git init
It doesn’t matter if the directory is empty of not. Existing files in the directory will be considered as untracked files after the repository is initialized.
Linux and MacOS
Assuming we are going to initialize a new repository in a new directory ~/projects/myrepo
. We run
|
|
After it, a hidden directory .git
is created
|
|
Windows
Use Git CMD as the terminal. Assuming we are going to initialize a new repository in a new folder %USERPROFILE%\Documents\myrepo
. We do
|
|
A hidden directory .git
is created
|
|