Skip to content

Validate git repository access

POST
/api/v1/projects/validate-git
curl --request POST \
--url https://api.deploybase.eu/api/v1/api/v1/projects/validate-git \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "git_provider": "github", "git_repo_url": "example", "git_token": "example", "git_username": "gitlab+deploy-token-123", "project_id": "example" }'

Tests whether a git repository URL is accessible, optionally with an access token

Git repository details

Media type application/json
object
git_provider

GitProvider picks the username the token is sent with. Omitted with a GitLab token (glpat-, gldt-), GitLab’s is used.

string
Allowed values: github gitlab bitbucket codeberg
git_repo_url
required
string
git_token
string
<= 500 characters
git_username

GitUsername is sent with the token instead of the provider default (needed for a GitLab deploy token). Requires git_token, or a project_id whose stored token it is tested with; without git_username a stored token goes with its stored username.

string
<= 255 characters

Example

gitlab+deploy-token-123
project_id

ProjectID, when set, lets validation fall back to the project’s stored token if git_token is omitted — so a saved credential can be tested.

string

OK

Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"data": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

Bad Request

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.

string
who_acts
string

Example generated

{
"code": "example",
"details": "example",
"docs_url": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
},
"next_actions": [
{
"action": "example",
"cli": "example",
"description": "example",
"http": "example",
"tool": "example"
}
],
"reason": "example",
"who_acts": "example"
}

GIT_VALIDATION_FAILED with details.git_error_code (deploy_token_username_required: a GitLab deploy token sent without git_username, refused before contacting the host) and, with auth_failed, details.git_error_reason (token_not_accepted: the host answered 401, the token is wrong, expired or revoked or a deploy token went with the wrong username; token_cannot_read: 403, the token was accepted but may not read code; token_needs_fine_grained: 403, the GitLab group accepts only fine-grained tokens; token_role_cannot_read: 403, the token’s GitLab role may not download this project’s code, e.g. a project token on the default Guest role; it needs Reporter or higher), or INVALID_INPUT with details.field git_username

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.

string
who_acts
string

Example generated

{
"code": "example",
"details": "example",
"docs_url": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
},
"next_actions": [
{
"action": "example",
"cli": "example",
"description": "example",
"http": "example",
"tool": "example"
}
],
"reason": "example",
"who_acts": "example"
}

Live 582ac705 built