Downloading Complete Repositories
Cloning creates a complete local copy of a remote repository—all files, all history, all branches.
Basic Clone
git clone https://github.com/username/repository.gitOr with SSH:
git clone git@github.com:username/repository.gitClone into Specific Directory
git clone https://github.com/user/repo.git my-folderWhat Clone Does
- Creates directory with repository name
- Initializes
.gitdirectory - Downloads all data
- Checks out default branch
- Sets up
originremote
Shallow Clone
For large repos, clone only recent history:
git clone --depth 1 https://github.com/user/repo.gitClone Specific Branch
git clone -b branch-name https://github.com/user/repo.gitAfter Cloning
cd repository
git status # See what branch you're on
git remote -v # Verify origin is setContributing to Projects
- Clone the repository
- Create a feature branch
- Make changes and commit
- Push your branch
- Create pull request on GitHub
Next: Ship Replication
Cloning gives you a copy. Next, learn forking—creating your own version of a project you can modify freely.