Update File
PUT/api/v5/repos/:owner/:repo/contents/:path
Request
Path Parameters
owner stringrequired
Repository space address (organization or individual's address path)
repo stringrequired
Repository path (path)
path stringrequired
The path of the file.
Query Parameters
access_token stringrequired
User authorization code
- application/json
Body
contentstringrequired
File content to be base64 encoded
shastringrequired
The Blob SHA of the file
branchstring
Branch name. Defaults to the repository's default branch.
messagestringrequired
commit message
author[name]string
Author's name, defaults to the current user's name
author[email]string
Author's email, defaults to the current user's email.
Responses
- 200
Successful Response
Response Headers
- application/json
- Schema
- Example (auto)
- Example
Schema
commit objectrequired
shastringrequired
author objectrequired
namestringrequired
emailstringrequired
datestringrequired
committer objectrequired
namestringrequired
emailstringrequired
datestringrequired
messagestringrequired
treestringrequired
parentsstring[]required
content objectrequired
namestringrequired
pathstringrequired
sizeintegerrequired
shastringrequired
typestringrequired
{
"commit": {
"sha": "string",
"author": {
"name": "string",
"email": "string",
"date": "string"
},
"committer": {
"name": "string",
"email": "string",
"date": "string"
},
"message": "string",
"tree": "string",
"parents": [
"string"
]
},
"content": {
"name": "string",
"path": "string",
"size": 0,
"sha": "string",
"type": "string"
}
}
{
"content": {
"name": "Note2.md",
"path": "Note2.md",
"url": "https://gitcode.com/api/v5/repos/daming_1/zhu_di/contents/Note2.md",
"html_url": "https://gitcode.com/daming_1/zhu_di/blob/master/Note2.md",
"download_url": "https://gitcode.com/daming_1/zhu_di/raw/master/Note2.md",
"_links": {
"self": "https://gitcode.com/api/v5/repos/daming_1/zhu_di/contents/Note2.md",
"html": "https://gitcode.com/daming_1/zhu_di/blob/master/Note2.md"
}
}
}