git clone

Suppose now John’s team has a new member. The new member want a copy of the current git repository. We can achieve that my git clone.

We talked about adding remote to an existing git repository. The other way to setup a remote is to create a local repository directly from a remote one. This is known as git cloning.

git clone <remote path> <folder name of local repository>

By default, git clone will clone the remote repository into a new directory with the same name, under the current folder.

The git clone command expects to create that folder. So the operation aborts when the local directory exists. It prevents the git clone command from overriding existing files and data.