Repos API
- List your repositories
- List user repositories
- List organization repositories
- List all repositories
- Create
- Get
- Edit
- List contributors
- List languages
- List Teams
- List Tags
- List Branches
- Get Branch
- Delete a Repository
List your repositories
List repositories for the authenticated user.
GET /user/repos
Parameters
- type
-
all,owner,public,private,member. Default:all. - sort
-
created,updated,pushed,full_name, default:full_name. - direction
-
ascordesc, default: when usingfull_name:asc, otherwisedesc.
List user repositories
List public repositories for the specified user.
GET /users/:user/repos
Parameters
- type
-
all,owner,member. Default:all. - sort
-
created,updated,pushed,full_name, default:full_name. - direction
-
ascordesc, default: when usingfull_name:asc, otherwisedesc.
List organization repositories
List repositories for the specified org.
GET /orgs/:org/repos
Parameters
- type
-
all,public,private,forks,sources,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
[
{
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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"
}
]
List all repositories
This provides a dump of every repository, in the order that they were created.
GET /repositories
Parameters
- since
- The integer ID of the last Repository that you’ve seen.
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"html_url": "https://github.com/octocat/Hello-World"
}
]
Create
Create a new repository for the authenticated user. OAuth users must supply
repo scope.
POST /user/repos
Create a new repository in this organization. The authenticated user must be a member of the specified organization.
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.
- auto_init
-
Optional boolean -
trueto create an initial commit with empty README. Default isfalse. - gitignore_template
-
Optional string - Desired language or platform .gitignore
template to
apply. Use the name of the template without the extension. For example, “Haskell”
Ignored if
auto_initparameter is not provided.
{
"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
{
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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/:owner/:repo
Response
The parent and source objects are present when the repo is a fork.
parent is the repo this repo was forked from,
source is the ultimate source for the network.
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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": {
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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": {
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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/:owner/: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. - default_branch
- Optional String - Update the default branch for this repository.
{
"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
{
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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": {
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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": {
"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",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"private": false,
"fork": false,
"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",
"homepage": "https://github.com",
"language": null,
"forks": 9,
"forks_count": 9,
"watchers": 80,
"watchers_count": 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/:owner/: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
List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language.
GET /repos/:owner/:repo/languages
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"C": 78769,
"Python": 7769
}
List Teams
GET /repos/:owner/: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/:owner/: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/:owner/:repo/branches
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"name": "master",
"commit": {
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
}
}
]
Get Branch
GET /repos/:owner/:repo/branches/:branch
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"name": "master",
"commit": {
"sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
"commit": {
"author": {
"name": "The Octocat",
"date": "2012-03-06T15:06:50-08:00",
"email": "octocat@nowhere.com"
},
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
"message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
"tree": {
"sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
"url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
},
"committer": {
"name": "The Octocat",
"date": "2012-03-06T15:06:50-08:00",
"email": "octocat@nowhere.com"
}
},
"author": {
"gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
"avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"url": "https://api.github.com/users/octocat",
"id": 583231,
"login": "octocat"
},
"parents": [
{
"sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
"url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
},
{
"sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
"url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"
}
],
"url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
"committer": {
"gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
"avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"url": "https://api.github.com/users/octocat",
"id": 583231,
"login": "octocat"
}
},
"_links": {
"html": "https://github.com/octocat/Hello-World/tree/master",
"self": "https://api.github.com/repos/octocat/Hello-World/branches/master"
}
}
Delete a Repository
Deleting a repository requires admin access. If OAuth is used, the
delete_repo scope is required.
DELETE /repos/:owner/:repo
Response
Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999