How to Clone a Git Repository (git clone)
git clone downloads a complete copy of a remote repository, including its full history, into a new local directory.
Published September 26, 2026
git clone downloads a complete copy of a remote repository, including its full history, into a new local directory.
Key points
- Automatically sets up a remote named "origin" pointing back to the source repository
- Checks out the default branch into a working directory ready to edit
- git clone --depth 1 performs a shallow clone with only the latest commit, useful for CI when full history isn't needed
Example
git clone https://github.com/user/repo.git