Delete fork dependency of a GitHub repository

前端 未结 6 862
心在旅途
心在旅途 2020-11-28 19:02

How can I make GitHub forget or disassociate that my repo was originally a fork of another project?

I forked a project in GitHub. I can now see \"forked from whateve

6条回答
  •  天涯浪人
    2020-11-28 19:40

    Using the info from aurelien and Clayton, I was able to do this with the following:

    $ git clone --bare https://github.com/my/forked_repo.git
    
    
    $ cd forked_repo.git
    $ git push --mirror
    

    Here's the documentation for git clone --bare:

    Make a bare Git repository. That is, instead of creating and placing the administrative files in /.git, make the itself the $GIT_DIR. This obviously implies the -n because there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.

    Here's the documentation for git push --mirror:

    Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote..mirror is set.

    Note: like the other git based answers, this will not copy over issues that are not part of the git repo such as the wiki and issues. Per Tapio:

    • The wiki is a separate git repo and can be handled in a similar fashion per Tapio. The address is: git@github.com:user/repo.wiki.git.
    • Issues can be exported via the GitHub API but there are issues recreating them since they can only be created by your user, so imports will lose information.

提交回复
热议问题