Skip to content

Delete a file in a repository

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

Deletes a specified file in a repository. Use the Commits API to delete 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
branch
required
string
nullable

Name of the branch to commit into. To create a new branch, also provide start_branch.

Example
main
commit_message
required
string
nullable

Commit message

Example
Initial commit
start_branch
string
nullable

Name of the branch to start the new commit from

Example
main
author_email
string
nullable

The email of the author

Example
johndoe@example.com
author_name
string
nullable

The name of the author

Example
John Doe
last_commit_id
string
nullable

Last known file commit id

Example
2695effb5807a22ff3d138d593fd856244e155e7

No Content

Bad Request

Not Found