🏠 Homepage 🏠 Syllabus of Day 2 ⬅️ Previous: ✅ Pushing Changes
Cloning is the process of creating a local copy of a remote repository on your computer. This allows you to work on the project files, make changes, and use Git commands locally.
Suppose you have forked https://github.com/samyak-shrestha/git-repo-example to your own account.
git@github.com:<your-username>/git-repo-example.git
https://github.com/<your-username>/git-repo-example.git
git clone git@github.com:<your-username>/git-repo-example.git
cd git-repo-example
git remote add upstream git@github.com:samyak-shrestha/git-repo-example.git
If you have permission to contribute directly, you can clone the original repository:
git clone git@github.com:samyak-shrestha/git-repo-example.git
cd git-repo-example
After cloning, you typically:
git checkout -b my-feature-branch
Make changes to files in your editor.
git add .
git commit -m "Describe your changes"
git push origin my-feature-branch
Now you’re ready to open a pull request or continue working!
Scenario | Command Example |
---|---|
Clone your fork (SSH) | git clone git@github.com:<your-username>/git-repo-example.git |
Clone your fork (HTTPS) | git clone https://github.com/<your-username>/git-repo-example.git |
Clone original repo | git clone git@github.com:samyak-shrestha/git-repo-example.git |
Tip:
➡️Up Next: 🍴 Forking a Repository