Clone

Cloning makes a full local copy of a remote repository, including all its files and complete history. git clone is usually the first command you run to start working on an existing project.

Git & DevOps

After cloning, Git automatically sets up a remote named origin that points back to where you copied from, so you can later push and pull changes.

You can clone over HTTPS or SSH. Cloning downloads the entire history, not just the latest files, which is what makes Git work offline.

Syntax

git clone <url>

Examples

Bash

git clone https://github.com/octocat/Hello-World.git

Output:

Cloning into 'Hello-World'...
remote: Enumerating objects: 26, done.
Receiving objects: 100% (26/26), done.

Learn it in a lesson

See also

Back to the Dictionary