v5

latestSwagger 2.0MIT2026-08-03485217850.7 KB
repository

Update a file in a repository if SHA is set, or create the file if SHA is not set

put/repos/{owner}/{repo}/contents/{filepath}

Path parameters

ownerstring required

owner of the repo

repostring required

name of the repo

filepathstring required

path of the file to update

Request body

branchstring

branch (optional) is the base branch for the changes. If not supplied, the default branch is used

contentstring required

content must be base64 encoded

force_pushboolean

force_push (optional) will do a force-push if the new branch already exists

from_pathstring

from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL

messagestring

message (optional) is the commit message of the changes. If not supplied, a default message will be used

new_branchstring

new_branch (optional) will make a new branch from base branch for the changes. If not supplied, the changes will be committed to the base branch

shastring

the blob ID (SHA) for the file that already exists to update, or leave it empty to create a new file

signoffboolean

Add a Signed-off-by trailer by the committer at the end of the commit log message.

Response

FileResponse