Skip to content
中文

Get a change workspace's read-only git credential

Code Mode: praxis.devops.changes.gitCredential

HTTP: POST /devops/v1/changes/{id}:gitCredential

A read-only git credential for the repository a change’s project is bound to: a GitHub App installation token limited to that one repository with contents read, which GitHub expires within an hour. It exists for git’s credential helper inside the change’s cloud workspace (praxis devops change git-credential, installed by DevOps when it clones the repository), so git fetch, history and lazily fetched file contents work there; the helper hands the token to that one git request and keeps nothing. Writing is never possible with it: commits reach the branch only through the unit push. You do not need to call this yourself. Anyone who can read the change can read its repository already through the code reads, so this grants no new access. An abandoned change is refused with INVALID_ARGUMENT and a project without a repository with SOURCE_NOT_CONFIGURED. The id is the branch name and its slash must be percent-encoded in the path (fix%2Fexpired-links).

Signature

praxis.devops.changes.gitCredential(args:{path:{/** e.g. "feat/run-page-v2" */ id:string}}):Promise<{/** The https clone URL of the repository the credential is for. e.g. "https://github.com/example/repo.git" */ url:string;/** The user name the source host requires with the token (GitHub App installation tokens use `x-access-token`). e.g. "x-access-token" */ username:string;/** The installation token, read-only and limited to the change's repository; GitHub expires it within an hour. e.g. "ghs_example" */ password:string}>;

Parameters

NameInTypeRequiredDescription
idpathstringyesThe change’s id, which is its branch name <type>/<slug> from a change list or create answer. Give it as it comes back — `feat/run-page-v2`: the SDK and the CLI encode the slash themselves, and an id that is already percent-encoded is encoded a second time and answers CHANGE_NOT_FOUND. Only a caller writing the HTTP request by hand sends feat%2Frun-page-v2.

Responses

StatusContent typesDescription
200application/jsonThe credential in the shape git’s credential protocol uses: the user name GitHub App tokens require and the token as the password.
400application/jsonINVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible.
404application/jsonCHANGE_NOT_FOUND means no change with that id exists in this organization; list the project’s changes and use an id from that answer, with its slash percent-encoded.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.