Clone

In Git, cloning means copying an existing remote repository to your current directory.

Some of the basic Git commands have been performed only on a local branch, that is, a branch that exists on your computer. Here’s a command that will help you interact with a remote branch — a branch on a server that can be accessed through the internet.

Syntax

The basic syntax for cloning in Git is this:

git clone <repo-URL>

Example

For example, if you want to clone Codecademy Docs, you can do so like this:

$ git clone https://github.com/codecademy/docs
Cloning into 'docs'...
remote: Enumerating objects: 21512, done.
remote: Counting objects: 100% (3517/3517), done.
remote: Compressing objects: 100% (1795/1795), done.
remote: Total 21512 (delta 2233), reused 1727 (delta 1466), pack-reused 17995
Receiving objects: 100% (21512/21512), 3.48 MiB | 9.56 MiB/s, done.
Resolving deltas: 100% (10600/10600), done.
Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn Git on Codecademy

Edit this page on GitHub

Contributors