git clone
Download a repository from a server with its whole history
What it does
git clone creates a folder named after the repository, downloads every commit and branch into it and switches to the main branch. The server is added as a remote called origin right away, so git pull and git push work with no setup.
Addresses come in two kinds: HTTPS (https://github.com/…) and SSH (git@github.com:…). SSH is handier once you have an SSH key set up: no password or token to type. A last argument names your own folder instead of the repository name.
Syntax
git clone <address>
git clone <address> <folder>Examples
Download the owner/shop repository from GitHub
git clone https://github.com/owner/shop.gitsame as:
git clone https://github.com/owner/shopclone— copy a repository with its whole historyhttps://github.com/owner/shop.git— repository address
Related commands
- git init — Create a new repository in the current folder
- git remote — List and add remote repositories
- git pull — Download changes from the server and merge them into the current branch