An overview of the most important Git commands
The "clone" command downloads an existing Git repository to your local computer.
You will then have a full-blown, local version of that Git repo and can start working on the project.
Typically, the "original" repository is located on a remote server, often from a service like GitHub, Bitbucket, or GitLab). That remote repository's URL is then later referred to as the "origin".
Specifies the URL of the remote repository. Usually, this will point to a remote server, using a protocol like HTTP, HTTPS, SSH, or GIT.
The name of the folder on your local machine where the repository will be downloaded into. If this option is not specified, Git will simply create a new folder named after the remote repository.
Clones and initializes all contained submodules. If your project contains submodules, using this parameter will make sure that all submodules will both be cloned and initialized once the main project has been cloned. This saves you from having to manually initialize and update the submodules later.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
In its simplest (and most common) form, only the repository URL is specified:
cd folder/to/clone-into/ git clone https://github.com/gittower/git-crash-course.git
This will download the project to a folder named after the Git repository ("git-crash-course" in this case). If you want a different folder name, simply specify it as the last parameter:
git clone https://github.com/gittower/git-crash-course.git other-name
Simple Cloning in Tower
In case you are using the Tower Git client, cloning a project becomes easy as pie. You can connect your GitHub / GitLab / Bitbucket / or other remote accounts with Tower - and from then on simply clone with a single click!
- Check out the chapter Starting with an Existing Project in our free online book
- Find the full command description in the Git documentation
- More frequently asked questions about Git & version control