Git-Mastery: Lessons

T3L1. Duplicating a Remote Repo on the Cloud


GitHub allows you to create your own remote copy of another repo through a process called forking.

This lesson covers that part.

A fork is a copy of a remote repository created on the same hosting service, such as GitHub, GitLab, or Bitbucket. On GitHub, you can fork a repository owned by another user or organization into your own space, such as your account or an organization where you have the required access. Forking is useful when you want to experiment with a repo but don't have write permissions to the original; it gives you your own remote copy without affecting the original repo.

HANDS-ON: Forking a repo on GitHub

Preparation Create a GitHub account if you don't have one yet.

1 Go to the GitHub repo you want to fork, e.g., samplerepo-things

2 Click the button in the top-right corner. On the next screen:

  • choose your own account or a GitHub organization where you are an admin.
  • uncheck the [ ] Copy the main branch only option, so that you get copies of other branches (if any) in the repo. You'll learn more about branches in a later lesson.

done!

Forking is not a Git feature, but a feature provided by hosted Git services like GitHub, GitLab, or Bitbucket.

GitHub does not allow you to fork the same repo more than once to the same destination. If you want to re-fork, you need to delete the previous fork.

EXERCISE: fork-repo