commits

Create a commit

This feature was introduced in GitLab 8.13

post/api/v4/projects/{id}/repository/commits

Request

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

Path parameters

idstring required

The ID or URL-encoded path of the project

Request body

filestring binary required

The commit content to be created (generated by Multipart middleware)

Response

Create a commit

idstring required
short_idstring required
created_atstring date-time required
parent_idsstring[] required
titlestring required
messagestring required
author_namestring required
author_emailstring required
authored_datestring date-time required
committer_namestring required
committer_emailstring required
committed_datestring date-time required
trailersobject required
extended_trailersobject required
web_urlstring required
statusstring required
project_idinteger required

Example response

{
  "id": "2695effb5807a22ff3d138d593fd856244e155e7",
  "short_id": "2695effb",
  "created_at": "2017-07-26T11:08:53.000+02:00",
  "parent_ids": [
    "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
  ],
  "title": "Initial commit",
  "message": "Initial commit",
  "author_name": "John Smith",
  "author_email": "john@example.com",
  "authored_date": "2012-05-28T04:42:42-07:00",
  "committer_name": "Jack Smith",
  "committer_email": "jack@example.com",
  "committed_date": "2012-05-28T04:42:42-07:00",
  "trailers": {
    "Merged-By": "Jane Doe janedoe@gitlab.com"
  },
  "extended_trailers": {
    "Signed-off-by": [
      "John Doe <johndoe@gitlab.com>",
      "Jane Doe <janedoe@gitlab.com>"
    ]
  },
  "web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746",
  "stats": {
    "additions": 1,
    "total": 1
  },
  "status": "success",
  "project_id": 1,
  "last_pipeline": {
    "id": 1,
    "iid": 2,
    "project_id": 3,
    "sha": "0ec9e58fdfca6cdd6652c083c9edb53abc0bad52",
    "ref": "feature-branch",
    "status": "success",
    "source": "push",
    "created_at": "2022-10-21T16:49:48.000+02:00",
    "updated_at": "2022-10-21T16:49:48.000+02:00",
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61"
  }
}

Changes

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