Git: Clone/Copy a Project

By Xah Lee. Date: . Last updated: .

Clone a projet means making a copy of an existing code base.

For example, you joined a team of projectX. First thing you need to do is to clone projectX to your computer, so you can work on it locally.

cd to a directory where you want the new project dir to be, then:

git clone url

The newly created dir have the same name as project name of the remote repository at url.

If a non-empty directory of the same name already exist, git will complain.

The url can be a local directory/folder path that contains “.git”.

Example:

# get a copy of git source code (~10MB)
git clone git://git.kernel.org/pub/scm/git/git.git
# get a copy of the xah fly keys source code
git clone https://github.com/xahlee/xah-fly-keys