Validate git repository access
const url = 'https://api.deploybase.eu/api/v1/api/v1/projects/validate-git';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"git_provider":"github","git_repo_url":"example","git_token":"example","git_username":"gitlab+deploy-token-123","project_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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
Authorizations
Section titled “ Authorizations ”Request Body
Section titled “ Request Body ”Git repository details
object
GitProvider picks the username the token is sent with. Omitted with a GitLab token (glpat-, gldt-), GitLab’s is used.
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.
Example
gitlab+deploy-token-123ProjectID, when set, lets validation fall back to the project’s stored token if git_token is omitted — so a saved credential can be tested.
Responses
Section titled “ Responses ”OK
object
object
Example generated
{ "data": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Bad Request
object
object
object
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.
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
object
object
object
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.
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