MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Forking Repositories and Cloning to Local Machine (git clone)0%
Study Materials
Git & GitHub BasicsProgress 0%
1.1What is Version Control? (Local, Centralized vs Distributed VCS)1.2Why Git? History, Architecture & Core Benefits1.3The Three Trees: Working Directory, Staging Area & Git Repository1.4Installing Git and Initial Configuration (git config user.name / email)
6.1Forking Repositories and Cloning to Local Machine (git clone)6.2Creating and Managing Pull Requests (PRs) on GitHub6.3Code Reviews, Inline Comments, Approvals and Changes Requested6.4Syncing Upstream Repositories and Keeping Forks Updated
HomeTutorialsGit & GitHub BasicsForking Repositories and Cloning to Local Machine (git clone)
Creating and Managing Pull Requests (PRs) on GitHub

Forking Repositories and Cloning to Local Machine (git clone)

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

Two of the most frequent ways to obtain code on GitHub are cloning and forking. While both involve copying a repository, they serve distinct roles in open-source development and enterprise collaboration.


1. Cloning a Repository: git clone

Cloning downloads an entire existing Git repository from a remote server (like GitHub) to your local computer:

  • It downloads all files, directories, commits, and branches.
  • It automatically configures the remote alias named origin pointing back to the cloned URL.
  • It automatically checks out the default branch (main).
1# Clone using SSH URL (Recommended)
2git clone git@github.com:facebook/react.git
3 
4# Or clone using HTTPS URL
5git clone https://github.com/facebook/react.git

Cloning into a Custom Directory Name:

By default, Git creates a folder named after the repository (react). You can specify a custom directory name as the last argument:

1git clone git@github.com:facebook/react.git my-react-study

Shallow Cloning (--depth 1):

For massive repositories (like Linux or Chromium) with 15 years of history, downloading every commit can take hours and gigabytes of disk space. A shallow clone downloads only the latest snapshot:

1git clone --depth 1 https://github.com/torvalds/linux.git

2. Forking a Repository

What if you want to contribute to an open-source project (like vuejs/core or django/django), but you are not an employee and do not have write access to push commits to their repository? This is where Forking comes in!

1Original Upstream Repo Your Personal Fork on GitHub
2[ github.com/facebook/react ] ----> [ github.com/sumit-msk/react ] (Your cloud copy)
3 |
4 git clone
5 |
6 v
7 Local Laptop [ D:/projects/react ]

What is a Fork?

  • A Fork is a complete copy of a repository that lives entirely on your personal GitHub account.
  • Because it lives under your account, you have full administrative write and push access to it.
  • You make your changes, commit them to your fork, and then submit a Pull Request (PR) back to the original author's repository.

How to Fork a Repo:

  1. 1
    Navigate to the public repository on GitHub (e.g., github.com/msk-institute/python-cheatsheet).
  2. 2
    In the top-right corner of the page, click the Fork button.
  3. 3
    Select your personal account and click Create fork.
  4. 4
    GitHub duplicates the repository under your username in seconds!

3. Cloning vs. Forking: Quick Summary

Featuregit cloneGitHub Fork
Where it happensOn your local computer diskOn GitHub's cloud servers
Tool UsedGit command line (git clone)GitHub Web UI button
Permissions neededRead access to the repositoryRead access to the public repository
Primary purposeGet files onto your laptop to run and developCreate a personal cloud copy to propose contributions to upstream repos

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What does git clone do?
Question 2
Where does a "Fork" reside?
Question 3
Why do developers fork open-source repositories before making contributions?
Question 4
Which command downloads only the single most recent commit snapshot of a repository, skipping historical commits?
Question 5
When you clone a repository with git clone <url>, what name does Git automatically assign to the remote bookmark?
Next Lesson

Creating and Managing Pull Requests (PRs) on GitHub

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Pushing and Pulling Code: git push -u origin main and git pullCreating and Managing Pull Requests (PRs) on GitHub

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Git & GitHub Basics with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext