Probe the configured Git Sync remote without saving.
POST
/git/test-connection
const url = 'https://your-server.example/api/git/test-connection';const options = { method: 'POST', headers: {cookie: 'session=<session>', 'Content-Type': 'application/json'}, body: '{"remote":"example","branch":"main","ssh_key_path":"example","https_username":"example","https_token":"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://your-server.example/api/git/test-connection \ --header 'Content-Type: application/json' \ --cookie session=<session> \ --data '{ "remote": "example", "branch": "main", "ssh_key_path": "example", "https_username": "example", "https_token": "example" }'Performs an ls-remote against the supplied remote with the supplied
credentials and reports whether auth succeeded and whether the branch
exists. Always returns 200 with a structured body; failures are
classified via the code field rather than via HTTP status.
If https_token is omitted (null), the currently stored token (if any)
is used. Pass an empty string to probe with no token.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
remote
required
string
branch
string
ssh_key_path
string
https_username
string
https_token
Null = use stored token; “” = no token; non-empty = use this token.
string
Responses
Section titled “Responses”Probe completed (success or classified failure).
Media typeapplication/json
object
ok
required
boolean
code
required
string
message
required
string
branch_found
required
boolean
raw_error
required
string
Example
{ "code": "ok"}Invalid request body.
Unauthenticated.
Not a super-admin.