curl --request PUT \
--url https://gogs.example.com/api/v1/repos/{owner}/{repo}/contents/{path} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"content": "<string>",
"branch": "<string>"
}
'{
"content": {
"type": "file",
"encoding": "<string>",
"size": 123,
"name": "<string>",
"path": "<string>",
"content": "<string>",
"sha": "<string>",
"url": "<string>",
"git_url": "<string>",
"html_url": "<string>",
"download_url": "<string>",
"_links": {
"git": "<string>",
"self": "<string>",
"html": "<string>"
}
},
"commit": {
"url": "<string>",
"sha": "<string>",
"html_url": "<string>",
"commit": {
"url": "<string>",
"message": "<string>",
"author": {
"name": "<string>",
"email": "<string>",
"date": "<string>"
},
"committer": {
"name": "<string>",
"email": "<string>",
"date": "<string>"
},
"tree": {
"url": "<string>",
"sha": "<string>"
}
},
"author": {
"id": 123,
"username": "<string>",
"login": "<string>",
"full_name": "<string>",
"email": "[email protected]",
"avatar_url": "<string>"
},
"committer": {
"id": 123,
"username": "<string>",
"login": "<string>",
"full_name": "<string>",
"email": "[email protected]",
"avatar_url": "<string>"
},
"parents": [
{
"url": "<string>",
"sha": "<string>"
}
]
}
}Creates or updates a file in the repository. The content must be base64 encoded.
curl --request PUT \
--url https://gogs.example.com/api/v1/repos/{owner}/{repo}/contents/{path} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"content": "<string>",
"branch": "<string>"
}
'{
"content": {
"type": "file",
"encoding": "<string>",
"size": 123,
"name": "<string>",
"path": "<string>",
"content": "<string>",
"sha": "<string>",
"url": "<string>",
"git_url": "<string>",
"html_url": "<string>",
"download_url": "<string>",
"_links": {
"git": "<string>",
"self": "<string>",
"html": "<string>"
}
},
"commit": {
"url": "<string>",
"sha": "<string>",
"html_url": "<string>",
"commit": {
"url": "<string>",
"message": "<string>",
"author": {
"name": "<string>",
"email": "<string>",
"date": "<string>"
},
"committer": {
"name": "<string>",
"email": "<string>",
"date": "<string>"
},
"tree": {
"url": "<string>",
"sha": "<string>"
}
},
"author": {
"id": 123,
"username": "<string>",
"login": "<string>",
"full_name": "<string>",
"email": "[email protected]",
"avatar_url": "<string>"
},
"committer": {
"id": 123,
"username": "<string>",
"login": "<string>",
"full_name": "<string>",
"email": "[email protected]",
"avatar_url": "<string>"
},
"parents": [
{
"url": "<string>",
"sha": "<string>"
}
]
}
}Personal access token. Use format: token {YOUR_ACCESS_TOKEN}
Owner of the repository
Name of the repository
Path of the file to create or update