Repos API
List your repositories
List repositories for the authenticated user.
GET /user/repos
Parameters
- type
-
all,owner,public,private,member. Default:all.
List user repositories
List public repositories for the specified user.
GET /users/:user/repos
Parameters
- type
-
all,owner,member. Default:public.
List organization repositories.
List repositories for the specified org.
GET /orgs/:org/repos
Parameters
- type
-
all,public,member. Default:all.
Response
Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
<https://api.github.com/resource?page=5>; rel="last"
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
}
]
Create
Create a new repository for the authenticated user.
POST /user/repos
Create a new repository in this organization. The authenticated user must
be a member of :org.
POST /orgs/:org/repos
Input
- name
- Required string
- description
- Optional string
- homepage
- Optional string
- private
-
Optional boolean -
trueto create a private repository,falseto create a public one. Creating private repositories requires a paid GitHub account. Default isfalse. - has_issues
-
Optional boolean -
trueto enable issues for this repository,falseto disable them. Default istrue. - has_wiki
-
Optional boolean -
trueto enable the wiki for this repository,falseto disable it. Default istrue. - has_downloads
-
Optional boolean -
trueto enable downloads for this repository,falseto disable them. Default istrue. - team_id
- Optional number - The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.
{
"name": "Hello-World",
"description": "This is your first repo",
"homepage": "https://github.com",
"private": false,
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
Response
Status: 201 Created
Location: https://api.github.com/repos/octocat/Hello-World
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
}
Get
GET /repos/:user/:repo
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"organization": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat",
"type": "Organization"
},
"parent": {
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
},
"source": {
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
},
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
Edit
PATCH /repos/:user/:repo
Input
- name
- Required string
- description
- Optional string
- homepage
- Optional string
- private
-
Optional boolean -
truemakes the repository private, andfalsemakes it public. - has_issues
-
Optional boolean -
trueto enable issues for this repository,falseto disable them. Default istrue. - has_wiki
-
Optional boolean -
trueto enable the wiki for this repository,falseto disable it. Default istrue. - has_downloads
-
Optional boolean -
trueto enable downloads for this repository,falseto disable them. Default istrue.
{
"name": "Hello-World",
"description": "This is your first repo",
"homepage": "https://github.com",
"public": true,
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"organization": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat",
"type": "Organization"
},
"parent": {
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
},
"source": {
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World",
"clone_url": "https://github.com/octocat/Hello-World.git",
"git_url": "git://github.com/octocat/Hello-World.git",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"mirror_url": "git://git.example.com/octocat/Hello-World",
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat"
},
"name": "Hello-World",
"description": "This your first repo!",
"homepage": "https://github.com",
"language": null,
"private": false,
"fork": false,
"forks": 9,
"watchers": 80,
"size": 108,
"master_branch": "master",
"open_issues": 0,
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z"
},
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
List contributors
GET /repos/:user/:repo/contributors
Parameters
- anon
- Optional flag. Set to
1ortrueto include anonymous contributors in results.
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "somehexcode",
"url": "https://api.github.com/users/octocat",
"contributions": 32
}
]
List languages
GET /repos/:user/:repo/languages
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"C": 78769,
"Python": 7769
}
List Teams
GET /repos/:user/:repo/teams
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"url": "https://api.github.com/teams/1",
"name": "Owners",
"id": 1
}
]
List Tags
GET /repos/:user/:repo/tags
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"name": "v0.1",
"commit": {
"sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc",
"url": "https://api.github.com/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
},
"zipball_url": "https://github.com/octocat/Hello-World/zipball/v0.1",
"tarball_url": "https://github.com/octocat/Hello-World/tarball/v0.1"
}
]
List Branches
GET /repos/:user/:repo/branches
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"name": "master",
"commit": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
}
}
]