Repositories Administration

September 20, 2019 ยท View on GitHub

Create a new repository

Create a new repository for a user or organization.

POST /admin/users/:username/repos

Parameters

NameTypeDescription
namestringRequired The name of the repository
descriptionstringA short description of the repository
privateboolEither true to create a private repository, or false to create a public one. Default is false
auto_initboolPass true to create an initial commit with README, .gitignore and LICENSE. Default is false
gitignoresstringDesired language .gitignore templates to apply. Use the name of the templates. For example, "Go" or "Go,SublimeText".
licensestringDesired LICENSE template to apply. Use the name of the template. For example, "Apache v2 License" or "MIT License".
readmestringDesired README template to apply. Use the name of the template. Default is Default

Example

{
  "name": "Hello-World",
  "description": "This is your first repository",
  "private": false
}

Response

Status: 201 Created
{
  "id": 27,
  "owner": {
    "id": 1,
    "username": "unknwon",
    "full_name": "",
    "email": "fake@local",
    "avatar_url": "/avatars/1"
  },
  "full_name": "unknwon/Hello-World",
  "private": false,
  "fork": false,
  "html_url": "https://try.gogs.io/unknwon/Hello-World",
  "clone_url": "https://try.gogs.io/unknwon/hello-world.git",
  "ssh_url": "git@try.gogs.io:unknwon/hello-world.git",
  "permissions": {
    "admin": true,
    "push": true,
    "pull": true
  }
}