Skip to content

Create a file in a repository

POST
/api/v4/projects/{id}/repository/files/{file_path}

Creates a file in a specified repository. Use the Commits API to create multiple files with a single request.

id
required
string

The project ID

Example
gitlab-org/gitlab
file_path
required
string

The URL-encoded path to the file.

Example
lib%2Fclass%2Erb
Media type multipart/form-data
object
file
required

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

string format: binary
nullable

Created

Bad Request

Not Found