Fork company repo as a regular GitHub user

Say, I wanted to get a fork of all my work (entire repository) from a company repo before being expelled from accessing this repo.

Sure, it is possible. Only this is called a mirror, not a fork.

Steps are following:

  1. Create new repository, that will act as your private “fork”.
  2. Get HTTPS / SSH addresses of both repositories and open console.
  3. Execute git clone --bare https://github.com/company/company-repository.git.
  4. cd to cloned local repository.
  5. Execute git push --mirror https://github.com/user/user-repository.git (a “fork”).
  6. cd up one level and rm -rf company-repository.git.

These are instruction for one-time duplication (“forking”) of a company repository as a regular user. Follow to this GitHub Help page for more details and for instruction on performing periodic updates of such “fork”.

Note, that step 3. is quite fast (up to speed of your connection; 1 MB/s at my side), while step 5 is often limited by GitHub to something around 60 kB/s. So, for large repositories, it usually takes a lot more time to finish.

Leave a Reply