v50

latestOpenAPI 3.0.3MITraw.githubusercontent.com2023-07-147873273.9 MB
repos

Create a repository for the authenticated user

Creates a new repository for the authenticated user.

OAuth scope requirements

When using OAuth, authorizations must include:

  • public_repo scope or repo scope to create a public repository. Note: For GitHub AE, use repo scope to create an internal repository.
  • repo scope to create a private repository.
post/user/repos

Request body

namestring required

The name of the repository.

descriptionstring

A short description of the repository.

homepagestring

A URL with more information about the repository.

privateboolean

Whether the repository is private.

has_issuesboolean

Whether issues are enabled.

has_projectsboolean

Whether projects are enabled.

has_wikiboolean

Whether the wiki is enabled.

has_discussionsboolean

Whether discussions are enabled.

team_idinteger

The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.

auto_initboolean

Whether the repository is initialized with a minimal README.

gitignore_templatestring

The desired language or platform to apply to the .gitignore.

license_templatestring

The license keyword of the open source license for this repository.

allow_squash_mergeboolean

Whether to allow squash merges for pull requests.

allow_merge_commitboolean

Whether to allow merge commits for pull requests.

allow_rebase_mergeboolean

Whether to allow rebase merges for pull requests.

allow_auto_mergeboolean

Whether to allow Auto-merge to be used on pull requests.

delete_branch_on_mergeboolean

Whether to delete head branches when pull requests are merged

squash_merge_commit_title'PR_TITLE' | 'COMMIT_OR_PR_TITLE'

The default value for a squash merge commit title:

  • PR_TITLE - default to the pull request's title.
  • COMMIT_OR_PR_TITLE - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
squash_merge_commit_message'PR_BODY' | 'COMMIT_MESSAGES' | 'BLANK'

The default value for a squash merge commit message:

  • PR_BODY - default to the pull request's body.
  • COMMIT_MESSAGES - default to the branch's commit messages.
  • BLANK - default to a blank commit message.
merge_commit_title'PR_TITLE' | 'MERGE_MESSAGE'

The default value for a merge commit title.

  • PR_TITLE - default to the pull request's title.
  • MERGE_MESSAGE - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
merge_commit_message'PR_BODY' | 'PR_TITLE' | 'BLANK'

The default value for a merge commit message.

  • PR_TITLE - default to the pull request's title.
  • PR_BODY - default to the pull request's body.
  • BLANK - default to a blank commit message.
has_downloadsboolean

Whether downloads are enabled.

is_templateboolean

Whether this repository acts as a template that can be used to generate new repositories.

Example request

{
  "name": "Team Environment",
  "has_issues": true,
  "has_projects": true,
  "has_wiki": true,
  "has_discussions": true,
  "gitignore_template": "Haskell",
  "license_template": "mit",
  "allow_squash_merge": true,
  "allow_merge_commit": true,
  "allow_rebase_merge": true,
  "has_downloads": true,
  "is_template": true
}

Response

Response

idinteger required

Unique identifier of the repository

node_idstring required
namestring required

The name of the repository.

full_namestring required
forksinteger required
privateboolean required

Whether the repository is private or public.

html_urlstring uri required
descriptionstring nullable required
forkboolean required
urlstring uri required
archive_urlstring required
assignees_urlstring required
blobs_urlstring required
branches_urlstring required
collaborators_urlstring required
comments_urlstring required
commits_urlstring required
compare_urlstring required
contents_urlstring required
contributors_urlstring uri required
deployments_urlstring uri required
downloads_urlstring uri required
events_urlstring uri required
forks_urlstring uri required
git_commits_urlstring required
git_refs_urlstring required
git_tags_urlstring required
git_urlstring required
issue_comment_urlstring required
issue_events_urlstring required
issues_urlstring required
keys_urlstring required
labels_urlstring required
languages_urlstring uri required
merges_urlstring uri required
milestones_urlstring required
notifications_urlstring required
pulls_urlstring required
releases_urlstring required
ssh_urlstring required
stargazers_urlstring uri required
statuses_urlstring required
subscribers_urlstring uri required
subscription_urlstring uri required
tags_urlstring uri required
teams_urlstring uri required
trees_urlstring required
clone_urlstring required
mirror_urlstring uri nullable required
hooks_urlstring uri required
svn_urlstring uri required
homepagestring uri nullable required
languagestring nullable required
forks_countinteger required
stargazers_countinteger required
watchers_countinteger required
sizeinteger required

The size of the repository. Size is calculated hourly. When a repository is initially created, the size is 0.

default_branchstring required

The default branch of the repository.

open_issues_countinteger required
is_templateboolean

Whether this repository acts as a template that can be used to generate new repositories.

topicsstring[]
has_issuesboolean required

Whether issues are enabled.

has_projectsboolean required

Whether projects are enabled.

has_wikiboolean required

Whether the wiki is enabled.

has_pagesboolean required
has_downloadsboolean required

Whether downloads are enabled.

archivedboolean required

Whether the repository is archived.

disabledboolean required

Returns whether or not this repository disabled.

visibilitystring

The repository visibility: public, private, or internal.

pushed_atstring date-time nullable required
created_atstring date-time nullable required
updated_atstring date-time nullable required
allow_rebase_mergeboolean

Whether to allow rebase merges for pull requests.

temp_clone_tokenstring
allow_squash_mergeboolean

Whether to allow squash merges for pull requests.

allow_auto_mergeboolean

Whether to allow Auto-merge to be used on pull requests.

delete_branch_on_mergeboolean

Whether to delete head branches when pull requests are merged

allow_update_branchboolean

Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging.

allow_merge_commitboolean

Whether to allow merge commits for pull requests.

allow_forkingboolean

Whether to allow forking this repo

subscribers_countinteger
network_countinteger
open_issuesinteger required
watchersinteger required
master_branchstring
starred_atstring
anonymous_access_enabledboolean

Whether anonymous git access is enabled for this repository

Example response

{
  "id": 42,
  "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
  "name": "Team Environment",
  "full_name": "octocat/Hello-World",
  "license": {
    "key": "mit",
    "name": "MIT License",
    "url": "https://api.github.com/licenses/mit",
    "spdx_id": "MIT",
    "node_id": "MDc6TGljZW5zZW1pdA=="
  },
  "organization": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "41d064eb2195891e12d0413f63227ea7",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "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}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "starred_at": "\"2020-07-09T00:17:55Z\""
  },
  "owner": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "41d064eb2195891e12d0413f63227ea7",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "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}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "starred_at": "\"2020-07-09T00:17:55Z\""
  },
  "html_url": "https://github.com/octocat/Hello-World",
  "description": "This your first repo!",
  "url": "https://api.github.com/repos/octocat/Hello-World",
  "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
  "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
  "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
  "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
  "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
  "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
  "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
  "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
  "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
  "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
  "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
  "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
  "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
  "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
  "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
  "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
  "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
  "git_url": "git:github.com/octocat/Hello-World.git",
  "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
  "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
  "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
  "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
  "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
  "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
  "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
  "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
  "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
  "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
  "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
  "ssh_url": "git@github.com:octocat/Hello-World.git",
  "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
  "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
  "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
  "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
  "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
  "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
  "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
  "clone_url": "https://github.com/octocat/Hello-World.git",
  "mirror_url": "git:git.example.com/octocat/Hello-World",
  "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
  "svn_url": "https://svn.github.com/octocat/Hello-World",
  "homepage": "https://github.com",
  "forks_count": 9,
  "stargazers_count": 80,
  "watchers_count": 80,
  "size": 108,
  "default_branch": "master",
  "is_template": true,
  "has_issues": true,
  "has_projects": true,
  "has_wiki": true,
  "has_downloads": true,
  "pushed_at": "2011-01-26T19:06:43Z",
  "created_at": "2011-01-26T19:01:12Z",
  "updated_at": "2011-01-26T19:14:43Z",
  "allow_rebase_merge": true,
  "allow_squash_merge": true,
  "allow_merge_commit": true,
  "starred_at": "\"2020-07-09T00:17:42Z\""
}