Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fork as organization after already forking in github

Is it possible to 'fork again' in github? I had forked a public repository, but then I became owner of an organization and I'd like to fork the same original repository again (not my fork). However, it seems that in order to choose to fork as an organization you can only do so by clicking on the 'fork' button, which because I had originally forked it, that button now says "your fork" to take me to my original fork, but doesn't let me choose "fork as organization."

like image 784
Ben Avatar asked Jan 26 '12 18:01

Ben


People also ask

Can you fork the same repository twice?

You are unable to fork a repo twice on Github (as of late 2021) but if you want to build on the same repo multiple times, you can use the "Import Repository" option and feed it the URL used to clone.

Can I fork a repo in same organization?

Fork a repository to the same organization as its parent Now, a repository can be forked to the same organization as its parent repository, addressing situations where people are working in one organization and don't want to fork a repository to a different organization or user account.

Can I delete a forked repository and fork it again?

There will not be any harm deleting the forked repositories. You can again fork that. It won't change the original code.


2 Answers

How about

  • Deleting your personal repository (making sure you've got a local clone/backup) by going to https://github.com/:your_login/:repo_identifier/admin then clicking the Delete Repository button in the Danger Zone.

enter image description here

  • Browsing to the upstream repository GitHub page (https://github.com/:upstream_login/:repo_identifier) should now display a Fork button.

  • Clicking the Fork button will display a dialog (similar to the one below) requesting if you're willing to fork to your personal area or your organization area.

    enter image description here

  • Once this is done, you can add to your local repository a remote pointing to the newly forked repository in your organization area.

$ git remote add your_organization [email protected]:your_organization/repo_identifier.git

UPDATE:

I may have found a (hackish) way to fulfill your request

  • Make sure you're logged in in GitHub
  • Open a new tab and go to https://github.com/:upstream_login/:repo_identifier/fork
  • This should display a page proposing to fork the upstream repository to your organization area.
  • Click on the button :)

Warning: this rely on an undocumented GitHub feature and this hack may stop working at any time. However, once the fork is created, even if the hack stops working, it is safe to think the fork should remain.

enter image description here

like image 162
nulltoken Avatar answered Oct 21 '22 14:10

nulltoken


You can fork to an organization using curl & the github API. The below example will fork the faraday ruby gem to the "your_organization" organization:

 curl https://api.github.com/repos/technoweenie/faraday/forks \
 -d '{"organization": "your_organization"}'

Note: you will want to change "your_organization" to the actual name of the organization you want to fork to. You may also need to authenticate to successfully fork.

Forking instructions via github developer documentation:

https://developer.github.com/changes/2012-11-27-forking-to-organizations/

like image 45
agbodike Avatar answered Oct 21 '22 13:10

agbodike