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.
git clone --bare https://github.com/company/company-repository.git.
cdto cloned local repository.
git push --mirror https://github.com/user/user-repository.git(a “fork”).
cdup 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.