Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github convert existing repo to a fork

Tags:

My organisation has a main repo called org/A.git. I forked it as me/A.git to Github first. My organisation admin made org/A.git private, which broke the fork. He then changed settings which would allow forking private repositories. me/A.git is still not a fork but a simple clone. How can I make me/A.git a fork again, without having to:

  1. Fork org/A.git again which would result in me/A-1.git.
  2. Delete me/A.git.
  3. Rename me/A-1.git to me/A.git.
  4. Push local changes to the new me/A.git.

I want to avoid the above 4 steps because I have additional contributors as well as branches in the original me/A.git and taking care of all that is just cumbersome for something which seems to be so simple.

like image 809
Akash Agarwal Avatar asked Feb 12 '19 23:02

Akash Agarwal


People also ask

Is cloning a repo the same as forking?

Any public Git repository can be forked or cloned. A fork creates a completely independent copy of Git repository. In contrast to a fork, a Git clone creates a linked copy that will continue to synchronize with the target repository.

Can you fork a forked repository?

In this model, you fork the project repository to your own account using the GitHub website. You can then clone the forked repository to your desktop as you would any other repo. Typically you would create a working branch on the local copy of the repo, edit the documents, then push the changes to GitHub.


1 Answers

This is very, very, very old... However, I recently faced a similar circumstance myself, and contacted GitHub Support. For me, it wasn't that it was a fork originally and then it was broken, but rather I created my own repo manually before understanding what a fork was (still new to Git). GitHub Support confirmed there was no way to do it, unfortunately.

The quote from them:

Thanks for reaching out! Sorry for the trouble, but it isn't possible to attach a repository as a fork of another in this kind of situation -- repositories can't move from one fork network to another, or to a network they were not originally created from.

like image 53
cdpautsch Avatar answered Oct 14 '22 20:10

cdpautsch