The git collection uses a provider ID for browsing, detection and reviewed source changes.
Use github for GitHub or gitlab for GitLab.com. Both support repository browsing, stack detection, cloning and push deployments. GitLab supports OAuth, access tokens and the local GitLab CLI through workspace connections. GitHub App installation, OAuth and device login are documented in the GitHub API.
Open Settings → Git → GitLab or New Project → Repositories → GitLab → Connect GitLab. Choose browser authorization or enter a personal, group or project access token. Read-only tokens need read_api and read_repository. Automatic deployments require api, permission to manage project webhooks and a reachable webhook endpoint.
To enable browser authorization, register a confidential GitLab OAuth application with the exact dashboard origin followed by /connections/callback. Select api and read_repository. Set OPENSHIP_CONNECTION_GITLAB_CLIENT_ID and OPENSHIP_CONNECTION_GITLAB_CLIENT_SECRET on the OpenShip API and restart it.
Desktop opens authorization in the system browser. Select Return to OpenShip Desktop after authorizing.
On desktop and self-hosted controllers, an instance administrator with workspace admin access can also select glab CLI after running glab auth login --hostname gitlab.com as the API's OS user. The CLI authenticates controller-local clones. Private clones that must run on the build server need a workspace OAuth connection or access token. Each workspace can keep both GitHub and GitLab connected.
const repository = await ship.git.getRepo({ provider: "github", owner: "acme", repo: "app" });
const branches = await ship.git.listBranches({ provider: "gitlab", owner: "acme/platform", repo: "app" });The owner is the complete provider namespace. Encode it as one URL path segment in REST requests. Unknown providers are rejected; they never use another provider's credentials.
Repository access alone permits metadata and deployment detection. Reading source requires source content permission; publishing requires write permission on every changed path. Unavailable capabilities return an explicit error. Tenant and repository authorization run inside the same platform operations for HTTP, native, SDK, CLI and MCP callers.
| Operation | SDK | REST API |
|---|---|---|
| List repositories visible to the caller. | git.listRepos(input) | GET /api/git/:provider/reposgit:read |
| Read repository metadata. | git.getRepo(input) | GET /api/git/:provider/repos/:owner/:repogit:read |
| List branches. | git.listBranches(input) | GET /api/git/:provider/repos/:owner/:repo/branchesgit:read |
| Browse files within granted source paths. | git.listFiles(input) | GET /api/git/:provider/repos/:owner/:repo/filesgit:read |
| Read the permitted repository tree. | git.listTree(input) | GET /api/git/:provider/repos/:owner/:repo/treegit:read |
| Read a file within granted source paths. | git.getFile(input) | GET /api/git/:provider/repos/:owner/:repo/filegit:read |
| Detect deployment settings without returning source contents. | git.detectStack(input) | GET /api/git/:provider/repos/:owner/:repo/detectgit:read |
| Publish reviewed changes with source write authorization. | git.publishChange(input) | POST /api/git/:provider/repos/:owner/:repo/changesgit:write |