Skip to main content

Delete a file

Deletes a file in a repository. You can provide an additional `committer` parameter, which is an object containing information about the committer. Or, you can provide an `author` parameter, which is an object containing information about the author. The `author` section is optional and is filled in with the `committer` information if omitted. If the `committer` information is omitted, the authenticated user's information is used. You must provide values for both `name` and `email`, whether you choose to use `author` or `committer`. Otherwise, you'll receive a `422` status code.

DELETE/repos/{owner}/{repo}/contents/{path}
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
path string
required

path parameter

Body Params
required
application/jsonobject
author object
optional

object containing information about the author.

email string
optional

The email of the author (or committer) of the commit

name string
optional

The name of the author (or committer) of the commit

branch string
optional

The branch name. Default: the repository’s default branch (usually `master`)

committer object
optional

object containing information about the committer.

email string
optional

The email of the author (or committer) of the commit

name string
optional

The name of the author (or committer) of the commit

message string
required

The commit message.

sha string
required

The blob SHA of the file being replaced.

Responses

application/json File Commit object

Response

commit object
required
author object
optional
date string
optional
email string
optional
name string
optional
committer object
optional
date string
optional
email string
optional
name string
optional
html_url string
optional
message string
optional
node_id string
optional
parents array[object]
optional
items object
html_url string
optional
sha string
optional
url string
optional
sha string
optional
tree object
optional
sha string
optional
url string
optional
url string
optional
verification object
optional
payload string
optionalnullable
reason string
optional
signature string
optionalnullable
verified boolean
optional
content object
requirednullable
_links object
optional
git string
optional
html string
optional
self string
optional
download_url string
optional
git_url string
optional
html_url string
optional
name string
optional
path string
optional
sha string
optional
size integer
optional
type string
optional
url string
optional
application/json Basic Error object

Resource not found

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Basic Error object

Conflict

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required
application/json object

Service unavailable

code string
optional
documentation_url string
optional
message string
optional