git clone Copy a remote repository onto your computer

Downloads a repository with its full history and sets up a link back to where it came from, named origin. It is the usual way to start work on an existing project.

Synopsis

git clone [OPTION]... URL [DIRECTORY]

Common options

Option or formWhat it does
URLThe repository address, https or ssh, such as https://github.com/user/repo.git
DIRECTORYFolder to clone into. By default it is named after the repository
-b NAME, --branch NAMECheck out that branch instead of the remote default
--depth NShallow clone: fetch only the last N commits, which is faster for big repositories
--recurse-submodulesAlso fetch any submodules the project uses

Examples

Clone over https
git clone https://github.com/octocat/Hello-World.git
Clone over ssh into a named folder
git clone [email protected]:octocat/Hello-World.git hello
Clone a single branch only
git clone -b develop --single-branch https://github.com/octocat/Hello-World.git
Clone quickly with only recent history
git clone --depth 1 https://github.com/octocat/Hello-World.git

Notes

See also

Last reviewed 2026-10-09.