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:
- Create new repository, that will act as your private “fork”.
- Get HTTPS / SSH addresses of both repositories and open console.
- Execute
git clone --bare https://github.com/company/company-repository.git
. cd
to cloned local repository.- Execute
git push --mirror https://github.com/user/user-repository.git
(a “fork”). cd
up one level andrm -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.