How To Initialize a Git Repository

A Git repository has to be initialized before being able to add files to it.

Open a command line and execute this from your home directory:

mkdir new_repository
cd new_repository
git init
git remote add origin <URL of the Git repository>
echo README file >
git add -A
git commit -m "Initial commit"
git push -u origin master
cd ..

In line #4, replace “<URL of the Git repository>” with the URL of the repository.

After running this, the repository will be initialized.

You can now delete the directory new_repository.