send: b'POST /api/v4/projects/11980/repository/commits HTTP/1.1\r\nHost: gitlab.com\r\nUser-Agent: python-requests/2.25.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nAuthorization: Bearer TOKEN\r\nContent-Length: 127\r\nContent-Type: application/json\r\n\r\n'
send: b'{"branch": "immortal", "commit_message": "create", "actions": [{"action": "create", "file_path": "1.json", "content": "test"}]}'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: cache-control: no-cache
header: server: istio-envoy
header: x-request-id: 01FH5DY50NJD24XPNQXRNXQGGV
header: x-frame-options: SAMEORIGIN
header: date: Mon, 04 Oct 2021 10:35:06 GMT
header: vary: Origin
header: x-content-type-options: nosniff
header: x-runtime: 0.072153
header: content-type: application/json
header: content-length: 72
header: x-envoy-upstream-service-time: 134
https://gitlab.com:443 "POST /api/v4/projects/11980/repository/commits HTTP/1.1" 400 72
{
"branch": "master",
"commit_message": "some commit message",
"actions": [
{
"action": "create",
"file_path": "foo/bar",
"content": "some content"
}
]
}
This allows you to create a single file. For creating multiple files with a single request see the commits API.