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 a Specific Directory
git clone https://github.com/user/repo.git my-folderWhat Clone Does
- Creates a directory with the repository name
- Initializes
.gitdirectory - Downloads all data
- Checks out default branch
- Sets up
originremote
Shallow Clone
For large repositories, clone only recent history:
git clone --depth 1 https://github.com/user/repo.gitClone a 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 a pull request on GitHub
Next: Parallel Timelines
Cloning gives you a copy of a project. Next, explore Git's most powerful feature: branching!