What happens to forks when a repository is deleted or changes visibility?

Deleting your repository or changing its visibility affects that repository's forks.

警告:

  • 如果您删除某人访问私有仓库的权限,则其对该私有仓库的任何复刻也会被删除。 将保留私人仓库的本地克隆。 如果撤销团队对私有仓库的访问权限,或者删除对私有仓库具有访问权限的团队,并且团队成员无法通过另一个团队访问仓库,则该仓库的私有复刻将被删除。

  • 您负责确保无法访问仓库的人员删除任何机密信息或知识产权。

  • 对私有仓库拥有管理员权限的人可以禁止对该仓库进行复刻,组织所有者可以禁止对组织中的任何私有仓库进行复刻。 更多信息请参阅“管理组织的复刻政策”和“管理仓库的复刻政策”。

Deleting a private repository

When you delete a private repository, all of its private forks are also deleted.

Deleting a public repository

When you delete a public repository, one of the existing public forks is chosen to be the new parent repository. All other repositories are forked off of this new parent and subsequent pull requests go to this new parent.

Private forks and permissions

私有复刻继承上游或父仓库的权限结构。 例如,如果上游仓库是私有的,并授予团队读/写访问权限,则同一团队对该私有上游仓库的任何复刻拥有读/写权限。 这有助于私有仓库的所有者保持对其代码的控制。

Changing a public repository to a private repository

If a public repository is made private, its public forks are split off into a new network. As with deleting a public repository, one of the existing public forks is chosen to be the new parent repository and all other repositories are forked off of this new parent. Subsequent pull requests go to this new parent.

In other words, a public repository's forks will remain public in their own separate repository network even after the parent repository is made private. This allows the fork owners to continue to work and collaborate without interruption. If public forks were not moved into a separate network in this way, the owners of those forks would need to get the appropriate access permissions to pull changes from and submit pull requests to the (now private) parent repository—even though they didn't need those permissions before.

Deleting the private repository

If a public repository is made private and then deleted, its public forks will continue to exist in a separate network.

Changing a private repository to a public repository

If a private repository is made public, each of its private forks is turned into a standalone private repository and becomes the parent of its own new repository network. Private forks are never automatically made public because they could contain sensitive commits that shouldn't be exposed publicly.

Deleting the public repository

If a private repository is made public and then deleted, its private forks will continue to exist as standalone private repositories in separate networks.

Further reading

此文档对您有帮助吗?

隐私政策

帮助我们创建出色的文档!

所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。

做出贡献

或者, 了解如何参与。