Create New File
POST/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
File path
Query Parameters
access_token stringrequired
User authorization code
- application/json
Body
contentstringrequired
File content to be base64 encoded
messagestringrequired
The commit message for the submitted commit.
branchstring
The submitted branch
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)
- 1
Schema
- Array [
- ]
commit object
shastring
author object
namestring
emailstring
datestring
committer object
namestring
emailstring
datestring
messagestring
parents object[]
shastring
{
"commit": {
"sha": "string",
"author": {
"name": "string",
"email": "string",
"date": "string"
},
"committer": {
"name": "string",
"email": "string",
"date": "string"
},
"message": "string",
"parents": [
{
"sha": "string"
}
]
}
}
Successful Example
{
"commit": {
"sha": "668cb104692b30d537b07f3721df9956d073d343",
"author": {
"name": "GitCode2023",
"email": "13328943+gitcode_admin@user.noreply.gitcode.com",
"date": "2024-04-11T09:15:20+00:00"
},
"committer": {
"name": "Gitee",
"email": "noreply@gitcode.com",
"date": "2024-04-11T09:15:20+00:00"
},
"message": "22222",
"parents": [
{
"sha": "0117aa5c6bc8e33d18ad8911afa3cbb54a1faabe"
}
]
}
}