The git hosts

Projects live on GitHub, GitLab, Bitbucket Cloud or Azure DevOps, the same remote forges Larapilot integrates with. All four are always there: a project's repository may live on any of them, and a team on several at once. Every person adds their own accounts in Settings → Accounts → Git, as many as they work with (see Git accounts); administrators add the team's service accounts.

ProviderRepositoriesA new one goes toThe agent's toolsPush webhook
GitHubhttps://github.com/owner/repoYour account or an organizationgh, with GH_TOKENRepository webhook, HMAC signature
GitLabhttps://gitlab.com/group/sub/repo, or your own GitLabYour namespace or a group / subgroupglab, with GITLAB_TOKEN (and GITLAB_HOST when self-managed)Project hook on the deploy branch, secret token
Bitbucket Cloudhttps://bitbucket.org/workspace/repoA workspace, or one of its projectsLarapilot's REST client, with BITBUCKET_ACCESS_TOKEN; no CLIRepository webhook on repo:push, HMAC signature
Azure DevOpshttps://dev.azure.com/org/project/_git/repoA project of the organizationaz repos (Azure CLI + azure-devops), with AZURE_DEVOPS_EXT_PATService hook on git.push, secret header

The installer asks for the host of the first administrator's token, with the address of a self-managed GitLab or the Azure DevOps organization, checks the token there (it becomes their first account) and installs that host's CLI; the CLI of another host is installed the first time a workspace on it needs it. In every workspace the token of the person's account on the repository's host is in the environment three ways: for git, through the askpass helper and with the user name the provider expects (x-access-token, oauth2, x-bitbucket-api-token-auth); for the CLI; and for Larapilot's integration. A repository Studio creates gets that integration turned on in its first commit (larapilot:settings-set --gitlab=YES and so on); in an existing repository the team turns it on once and commits .larapilot/config.yaml.

Service accounts#

A project site is cloned, given its push webhook and deployed with one git account. An administrator's own token works, but it goes when they leave. In Administration → Connectors → Git hosting administrators keep the team's own tokens instead: a bot user, a project or group access token. Service accounts create repositories, register the webhooks and deploy the sites, whoever the administrator is. They are offered first in the new-project form and in the project's Settings → General → Deployed with. Nobody commits with them: people work with their own accounts. A service account that deploys projects cannot be removed until those projects use another one. Its token needs the administrators' scopes below.

GitHub#

Organizations. A new repository goes to your account or to an organization you belong to; the form lists the organizations your token can see, and creating a repository there needs the right to do so in that organization. Organizations that restrict fine-grained tokens approve them in Organization settings → Personal access tokens. With SAML single sign-on, a classic token must be authorized for the organization (Configure SSO next to the token).

  1. Where. GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.
  2. Resource owner. The organization that owns the projects, or your account. A fine-grained token reaches one owner: when projects live in several organizations, use a classic token with repo, read:org and admin:repo_hook.
  3. Repository access. The repositories of the projects, or all of them; administrators who create repositories need all of them.
  4. Permissions, everyone. Contents read and write, Pull requests read and write, Metadata read.
  5. Permissions, administrators. Also Administration read and write (new repositories) and Webhooks read and write (the deploy webhook).

GitLab#

Groups. A new repository goes to your personal namespace or to a group or subgroup where you are at least Developer and the group lets that role create projects; the form lists those groups by their full path. A self-managed GitLab is the address given with the account (https://git.example.com; the installer's STUDIO_GIT_URL for the first administrator's), and the agent's glab gets it as GITLAB_HOST. Registering the deploy webhook needs the Maintainer role on the repository.

  1. Where. On your GitLab: avatar → Edit profile → Access tokens → Add new token.
  2. Scope. api: clone and push, merge requests through glab and Larapilot, and for administrators the new repositories and the webhook. read_repository and write_repository alone let git work, not merge requests.
  3. Expiration. GitLab asks for a date. Replace the token in Studio before it expires.
  4. Copy it into Settings → Accounts → Git → Add an account → GitLab. It starts with glpat-.

Bitbucket Cloud#

Workspaces and projects. A Bitbucket repository belongs to a workspace and to one of its projects. The form lists the workspaces you belong to and their projects: a workspace alone puts the repository in its oldest project, a project puts it there. Creating repositories needs a workspace role that allows it; registering the webhook needs admin rights on the repository.

  1. Where. id.atlassian.com → Account settings → Security → Create and manage API tokens → Create API token with scopes → Bitbucket. API tokens replace app passwords: git signs in with the token as x-bitbucket-api-token-auth, the REST API with the token as a bearer.
  2. Scopes, everyone. read:user, read:workspace, read:repository, write:repository, read:pullrequest, write:pullrequest (each ends in :bitbucket).
  3. Scopes, administrators. Also read:project, admin:repository (new repositories), read:webhook, write:webhook and delete:webhook (the deploy webhook).
  4. Expiration. Up to a year. Replace the token in Studio before it expires.

Azure DevOps#

Organization and projects. An Azure DevOps account belongs to one organization, given with the account (https://dev.azure.com/acme; acme.visualstudio.com addresses work too; the installer's STUDIO_GIT_URL for the first administrator's). Another organization is another account. Repositories live in the organization's projects: the form lists them, and a new repository follows the visibility of its project. A project's address must be in the organization of the account that creates or deploys it. Creating repositories needs the Create repository permission on the project; registering the push service hook needs Project Administrator.

  1. Where. https://dev.azure.com/<organization> → User settings → Personal access tokens → New Token.
  2. Organization. This Studio's, or all accessible organizations.
  3. Scopes, everyone. Custom defined → Code → Read & write.
  4. Scopes, administrators. Code → Read, write & manage, and Project and Team → Read.
  5. Expiration. At most a year, or less when the organization's policy says so.

The login on Azure DevOps is the account's e-mail address; the handle is its first part (maria.rossi@acme.com → maria-rossi).