Create or update file contents
Creates a new file or replaces an existing file in a repository.
/repos/{owner}/{repo}/contents/{path}- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
- path stringrequired
path parameter
Body Params
required author objectoptionalThe author of the file. Default: The `committer` or the authenticated user if you omit `committer`.
The author of the file. Default: The `committer` or the authenticated user if you omit `committer`.
Example: "2013-01-15T17:13:22+05:00"
The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted.
The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted.
The branch name. Default: the repository’s default branch (usually `master`)
committer objectoptionalThe person that committed the file. Default: the authenticated user.
The person that committed the file. Default: the authenticated user.
Example: "2013-01-05T13:13:22+05:00"
The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted.
The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted.
The new file content, using Base64 encoding.
The commit message.
**Required if you are updating a file**. The blob SHA of the file being replaced.
Responses
Response
commit objectrequired
author objectoptional
committer objectoptional
parents array[object]optional
items object
tree objectoptional
verification objectoptional
content objectrequirednullable
_links objectoptional
Response
commit objectrequired
author objectoptional
committer objectoptional
parents array[object]optional
items object
tree objectoptional
verification objectoptional
content objectrequirednullable
_links objectoptional
Resource not found
Conflict
Validation failed