Rename a branch
PATCH
/repos/{owner}/{repo}/branches/{branch}
const url = 'https://gitea.com/api/v1/repos/example/example/branches/example';const options = { method: 'PATCH', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://gitea.com/api/v1/repos/example/example/branches/example \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repo
branch
required
string
Name of the branch
Request Body
Section titled “Request Body”Media typeapplication/json
RenameBranchRepoOption options when renaming a branch in a repository
object
name
required
New branch name
string
Examplegenerated
{ "name": "example"}Responses
Section titled “Responses”APIEmpty is an empty response
APIForbiddenError is a forbidden error response
Headers
Section titled “Headers”message
string
url
string
APINotFound is a not found empty response
APIValidationError is error format response related to input validation
Headers
Section titled “Headers”message
string
url
string