👋 We've unified all of GitHub's product documentation in one place! Check out the content for REST API, GraphQL API, and Developers. Learn more on the GitHub blog.

文章版本: GitHub.com





组织所有者可以限制只有组织所有者才能更改仓库可见性。 更多信息请参阅“限制组织的仓库可见性更改”。

We recommend reviewing the following caveats before you change the visibility of a repository.


  • GitHub will detach public forks of the public repository and put them into a new network. 公共复刻无法设为私有。 If you change a repository's visibility from internal to private, GitHub will remove forks that belong to any user without access to the newly private repository. For more information, see "What happens to forks when a repository is deleted or changes visibility?"
  • If you're using GitHub Free for user accounts or organizations, some features won't be available in the repository after you change the visibility to private. 更多信息请参阅“GitHub 的产品”。
  • 任何已发布的 GitHub Pages 站点都将自动取消发布。 如果您将自定义域添加到 GitHub Pages 站点,应在将仓库设为私有之前删除或更新 DNS 记录,以避免域接管的风险。 更多信息请参阅“管理 GitHub Pages 网站的自定义域
  • GitHub will no longer included the repository in the GitHub 存档计划. For more information, see "About archiving content and data on GitHub."


Changing a repository's visibility

  1. 在 GitHub 上,导航到仓库的主页面。
  2. 在仓库名称下,单击 Settings(设置)
  3. Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility.
    Change visibility button
  4. Select a visibility.
    Dialog of options for repository visibility
  5. To verify that you're changing the correct repository's visibility, type the name of the repository you want to change the visibility of.
  6. Click I understand, change repository visibility.
    Confirm change of repository visibility button