Create Repo Using Template
Creates a new repository using a repository template. Use the template_owner
and template_repo
route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the Get a repository endpoint and check that the is_template
key is true
.
OAuth scope requirements
When using OAuth, authorizations must include:
public_repo
scope orrepo
scope to create a public repository. Note: For GitHub AE, userepo
scope to create an internal repository.repo
scope to create a private repository.
External Documentation
To learn more, visit the GitHub documentation.
Basic Parameters
Parameter | Description |
---|---|
Description | A short description of the new repository. |
Include All Branches | Set to true to include the directory structure and files from all branches in the template repository, and not just the default branch. Default: false . |
New Repo Name | The name of the new repository. |
New Repo Owner | The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization. |
Template Owner | The user who owns the template repo. |
Template Repo | The name of the template repo. |
Advanced Parameters
Parameter | Description |
---|---|
Private | Either true to create a new private repository or false to create a new public one. |
Example Output
{
"value": {
"allow_auto_merge": false,
"allow_rebase_merge": true,
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"created_at": "2011-01-26T19:01:12Z",
"default_branch": "master",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"description": "This your first repo!",
"disabled": false,
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"fork": false,
"forks": 9,
"forks_count": 9,
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"full_name": "octocat/Hello-World",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": "https://github.com",
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
"html_url": "https://github.com/octocat/Hello-World",
"id": 1296269,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"language": null,
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"license": {
"html_url": "https://github.com/licenses/mit",
"key": "mit",
"name": "MIT License",
"node_id": "MDc6TGljZW5zZW1pdA==",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit"
},
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"name": "Hello-World",
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"open_issues": 0,
"open_issues_count": 0,
"owner": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
},
"permissions": {
"admin": false,
"pull": true,
"push": false
},
"private": false,
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"pushed_at": "2011-01-26T19:06:43Z",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"size": 108,
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_count": 80,
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"updated_at": "2011-01-26T19:14:43Z",
"url": "https://api.github.com/repos/octocat/Hello-World",
"visibility": "public",
"watchers": 80,
"watchers_count": 80
}
}
Workflow Library Example
Create Repo Using Template with Github and Send Results Via Email
Preview this Workflow on desktop