project_import

Import a repository from GitHub

Imports a repository from GitHub to GitLab.

post/api/v4/import/github

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Request body

personal_access_tokenstring required

GitHub personal access token

repo_idinteger required

GitHub repository ID

new_namestring

New repo name

target_namespacestring required

Namespace or group to import repository into

github_hostnamestring

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.

optional_stagesobject

Optional stages of import to be performed

timeout_strategy'optimistic' | 'pessimistic'

Strategy for behavior on timeouts

pagination_limitinteger

Pagination limit

Response

Import a repository from GitHub

idinteger required
namestring required
full_pathstring required
full_namestring required
refs_urlstring required
forkedboolean required

Example response

{
  "id": 1,
  "name": "GitLab",
  "full_path": "gitlab-org/gitlab",
  "full_name": "GitLab Org / GitLab",
  "forked": true
}

Changes

No recorded changes to this operation across all 5 revisions of this API.