Skip to main content

Creating a repository from a template

You can generate a new repository with the same directory structure and files as an existing repository.

About repository templates

Anyone with read permissions to a template repository can create a repository from that template. For more information, see "Creating a template repository."

Tip: You can also create a repository from a template using the GitHub CLI. For more information, see "gh repo create" in the GitHub CLI documentation.

You can choose to include the directory structure and files from only the default branch of the template repository or to include all branches. Branches created from a template have unrelated histories, which means you cannot create pull requests or merge between the branches.

Creating a repository from a template is similar to forking a repository, but there are important differences:

  • A new fork includes the entire commit history of the parent repository, while a repository created from a template starts with a single commit.
  • Commits to a fork don't appear in your contributions graph, while commits to a repository created from a template do appear in your contribution graph.
  • A fork can be a temporary way to contribute code to an existing project, while creating a repository from a template starts a new project quickly.

For more information about forks, see "About forks."

Creating a repository from a template

  1. On your GitHub Enterprise Server instance, navigate to the main page of the repository.

  2. Above the file list, click Use this template.

  3. [所有者] ドロップダウン メニューを使い、リポジトリを所有させたいアカウントを選択します。 [所有者] ドロップダウン メニュー

  4. リポジトリの名前と、任意で説明を入力してください。 リポジトリ作成フィールド

  5. リポジトリの可視性を選択してください。 詳細については、リポジトリに関する説明を参照してください。 リポジトリの可視性を選択するラジオ ボタン

  6. Optionally, to include the directory structure and files from all branches in the template, and not just the default branch, select Include all branches. Include all branches checkbox

  7. Click Create repository from template.