Skip to main content

此版本的 GitHub Enterprise Server 将于以下日期停止服务 2026-03-17. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

管理仓库的默认分支名称

可以为在 GitHub 上创建的新存储库设置默认分支名称。

About management of the default branch name

When you create a new repository on GitHub, the repository contains one branch, which is the default branch. You can change the name that GitHub uses for the default branch in new repositories you create. For more information about the default branch, see About branches.

You can change the default branch for an existing repository. For more information, see Changing the default branch.

Setting the default branch name

  1. In the upper-right corner of any page on GitHub, click your profile picture, then click Settings.
  2. In the "Code planning, and automation" section of the sidebar, click Repositories.
  3. In the text field, type the default name that you would like to use for new repositories.
  4. Click Update.

Further reading