Skip to content

Import a repository from GitHub

POST
/api/v4/import/github

Imports a repository from GitHub to GitLab.

Media type application/json
object
personal_access_token
required

GitHub personal access token

string
nullable
repo_id
required

GitHub repository ID

integer
nullable
new_name

New repo name

string
nullable
target_namespace
required

Namespace or group to import repository into

string
nullable
github_hostname

Custom GitHub enterprise hostname. For example: https://github.example.com. From GitLab 16.5 to GitLab 17.1, you must include the path /api/v3.

string
nullable
optional_stages

Optional stages of import to be performed

object
timeout_strategy

Strategy for behavior on timeouts

string
nullable
Allowed values: optimistic pessimistic
pagination_limit

Pagination limit

integer
nullable >= 1 <= 100

Created

Media type application/json
object
id
integer
name
string
full_path
string
full_name
string
refs_url
string
forked
boolean
Example
{
"id": 1,
"name": "GitLab",
"full_path": "gitlab-org/gitlab",
"full_name": "GitLab Org / GitLab",
"forked": true
}

Bad request

Unauthorized

Forbidden

Unprocessable entity

Service unavailable