Git - Setting up Git repository

Git

There are two ways we can setup a Git repository. The first scenario is to create a brand new Git repository from scratch. This is common if we are starting a new project. The second scenario is to clone an exisitng repository. This is common when a new developer is added to a project and she pulls the Git repository in her local machine.

Creating a brand new repository

We use the git init command when we want to create a new repository (repo).

We can either run this command inside the project folder or add the path of the project folder as an option like git init path/to/project folder.

This command will create a .git directory in the present working directory and will also create a master branch. More on branches in the later tutorial.