Change a Git connection; a new token is checked first.
const url = 'https://example.com/api/v1/git/connections/example';const options = { method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","baseUrl":"example","token":"example","defaultBranch":"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://example.com/api/v1/git/connections/example \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "baseUrl": "example", "token": "example", "defaultBranch": "example" }'Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Connection id
Request Bodyrequired
Section titled “Request Bodyrequired”Only the members given change.
object
A new token; write-only. The connection is checked again.
Null clears it.
Examplegenerated
{ "name": "example", "baseUrl": "example", "token": "example", "defaultBranch": "example"}Responses
Section titled “Responses”An organization’s token connection to a Git provider. The token is never returned.
object
github (a personal or fine-grained token; the GitHub App has its
installations), gitlab, or gitea (Gitea and Forgejo).
The provider’s API root: https://api.github.com, https://gitlab.com,
a self-hosted URL.
token.
The account the token belongs to, as the provider named it at the last check.
The branch new sources suggest when the repository names none.
The last four characters of the token.
Where the provider sends push events for this connection
(/api/v1/webhooks/github/{id}, /api/v1/webhooks/gitlab/{id} or
/api/v1/webhooks/gitea/{id}); absolute when server.public_url is set.
The secret the provider’s push webhooks carry (GitHub: the webhook’s
Secret, which signs the body with X-Hub-Signature-256; GitLab: the
webhook’s Secret token; Gitea/Forgejo: its Secret, which signs the body). Present
only in the answer of createGitConnection, never again: rotate it with
POST /api/v1/git/connections/{connection}/webhook-secret.
Why the last check failed.
Example
{ "name": "gitlab-acme", "provider": "github", "baseUrl": "https://gitlab.com"}Problem Details body.
object
Stable machine-readable code, e.g. forbidden.
Short human readable title.
HTTP status.
Details, if safe to expose.
Example
{ "code": "forbidden"}Problem Details body.
object
Stable machine-readable code, e.g. forbidden.
Short human readable title.
HTTP status.
Details, if safe to expose.
Example
{ "code": "forbidden"}The name is taken
Problem Details body.
object
Stable machine-readable code, e.g. forbidden.
Short human readable title.
HTTP status.
Details, if safe to expose.
Example
{ "code": "forbidden"}Problem Details body.
object
Stable machine-readable code, e.g. forbidden.
Short human readable title.
HTTP status.
Details, if safe to expose.
Example
{ "code": "forbidden"}Problem Details body.
object
Stable machine-readable code, e.g. forbidden.
Short human readable title.
HTTP status.
Details, if safe to expose.
Example
{ "code": "forbidden"}