For the complete documentation index, see llms.txt. A markdown version of this page is at /guides/connect-github-app/index.md.

Connect workstations to GitHub with the Ringleader GitHub App

Let workstations clone, push and open pull requests on GitHub with short-lived tokens that Ringleader gets and renews for you.

Let workstations clone, push and open pull requests on GitHub with short-lived tokens that Ringleader gets and renews for you, so nobody creates, pastes or rotates a personal access token. The workstations act either as the Ringleader GitHub App or as each workstation’s owner. Use this when you want GitHub access for a team without a key to manage.

Prerequisites

  • Ringleader installed.
  • Admin rights in your Ringleader organization, to install the app and name its provider. A namespace admin can do the same for one namespace.
  • An owner of the GitHub organization, to link the app. You can be that owner, or send them a link.
  • Workstations in the namespace acme, labeled team: platform. The examples use an organization named acme; replace the names with yours.

Choose whose name the workstations use

Choose whose name the workstations’ pushes and pull requests carry:

Both need the app installed on your GitHub organization.

Install the Ringleader GitHub App

The app is installed on GitHub and then linked to a provider in Ringleader, so that only your organization’s workstations get tokens for it. Two commands start an install:

  • rl orgcredentialprovider install <name> links it to an organization’s provider. An org admin runs it.
  • rl credentialprovider install <name> -n <namespace> links it to one namespace’s provider. A namespace admin runs it.

If the provider does not exist, the command creates it, set to use the shared app. An organization’s provider also needs --org, and its name must start with the organization’s name and a hyphen, as in acme-github. For the Ringleader organization acme:

  1. Run the install command:

    rl orgcredentialprovider install acme-github --org acme

    The command prints a link to GitHub’s install page, opens it in a browser, and waits up to 10 minutes for an installation to be linked.

  2. On GitHub, pick the GitHub organization or account and the repositories the app may reach.

  3. On the page Ringleader shows next, check that it names the right provider, and press Link. The page names the Ringleader organization, the namespace for a namespace’s provider, the provider, and the email of the person who started the install. Don’t link cancels.

  4. Wait for the command to print the installation and the GitHub account it linked, for example Linked installation 12345678 (acme) to OrgCredentialProvider acme-github. The command then exits.

On Link, Ringleader checks the installer’s own GitHub sign-in. They must be able to see the installation and own the account it is on. For a GitHub organization, that means an owner of the organization. If you are not an owner, send the install link to one, who opens it and presses Link. The link works for 30 minutes, so the owner can finish after the command stops waiting.

Install flags lists the command’s options.

An admin can also install the app from the Ringleader console. Under Admin in the console’s sidebar, open Git Providers and click Install the Ringleader GitHub App. Once the page lists an installation, that button reads Add GitHub Account. GitHub’s install page opens in a new tab, and steps 2 and 3 are the same. If your organization has no provider for the app yet, the console creates one named after it, such as acme-ringleader-github. The Ringleader desktop app has no button that installs the app.

Check the linked installations

To see what a provider has linked, read its status.installations:

rl orgcredentialprovider get acme-github -o yaml

Each installation is listed with its id and its GitHub account. One provider can hold several installations, for example one per GitHub organization your company uses.

Apply an Integration for the app’s token

For tokens that act as the app, apply an Integration that names the provider. The Integration below sets the repositories and permissions the token gets:

  1. Save this file as github.yaml:

    apiVersion: workstations.ringleader.dev/v1
    kind: Integration
    metadata:
      name: github
      namespace: acme
    spec:
      type: httpProxy
      selector:
        matchLabels:
          team: platform
      httpProxy:
        vendor: github
        credentialSource:
          provider:
            kind: OrgCredentialProvider
            name: acme-github
          repositories: [acme/api, acme/web]
          permissions:
            contents: write
            pull_requests: write
  2. Optional: add toolconfigs: [{name: gh}] under httpProxy to have Ringleader configure the GitHub CLI to use HTTPS.

  3. Apply the file:

    rl apply -f github.yaml

Workstations labeled team: platform can now clone and push acme/api and acme/web over HTTPS, and call the GitHub API for them. Ringleader supplies the request rules for Git and the GitHub APIs, so you do not write headers or repeat hosts in the Integration. The token is added where credential injection adds a key: on a cloud workstation, that is the namespace’s Edge.

Connect your GitHub account

Connect your GitHub account once, so your own workstations act as you on GitHub through an Integration with userAuthorization: boxOwner:

  1. Run the connect command:

    rl userauthorization connect GlobalCredentialProvider/github

    The command starts GitHub’s device flow. It prints a code and an address, and opens the address in a browser. If your organization uses SAML single sign-on on GitHub, sign in through it first.

  2. On GitHub’s page, enter the code and approve the Ringleader GitHub App. The command then prints the GitHub account it connected. No token passes through the command.

  3. Apply an Integration that asks for the workstation owner’s token:

    apiVersion: workstations.ringleader.dev/v1
    kind: Integration
    metadata:
      name: github-as-owner
      namespace: acme
    spec:
      type: httpProxy
      selector:
        matchLabels:
          team: platform
      httpProxy:
        vendor: github
        credentialSource:
          provider:
            kind: GlobalCredentialProvider
            name: github
          userAuthorization: boxOwner

When two people’s workstations match this Integration, each pushes as their own owner. A workstation whose owner has not connected gets no token, and rl workstation describe <name> tells its owner to run the connect command. A token that acts as the owner is added on that owner’s own qemu, vz or hcs workstation as well as on a cloud workstation, with no allowDaemonPlacement setting.

The connection reaches only repositories where the app is installed and your GitHub account has access. It names only GlobalCredentialProvider/github, the shared app. If you leave the GitHub organization, the connection loses that organization’s repositories. Connect flags lists the command’s options.

You can also connect from the Credentials page of the Ringleader console, or of the Ringleader desktop app while you are signed in:

  1. Click Add credential, then Connect your GitHub account.
  2. Click Connect GitHub account. GitHub’s page opens in your browser.
  3. On GitHub’s page, enter the code the drawer shows and approve the Ringleader GitHub App.
  4. Click Continue to workstations, and choose which of your workstations get the token.
  5. Click Continue to summary, then Add github-account. The button carries the credential’s name, github-account unless you changed it.

Besides connecting your account, the drawer adds an Integration that asks for your token, like github-as-owner above, in each namespace you can write to. The page then lists it as a credential. To connect again or remove the connection later, select the credential and click Manage GitHub connection.

Keep your GitHub account connected

GitHub’s token lasts 8 hours, and Ringleader renews it for you. If GitHub refuses a renewal, for example because you revoked the app on GitHub, your workstations stop getting a token and say to connect again. Run the connect command again.

To list your connections, and to remove one:

rl userauthorization get
rl userauthorization delete <name>

get shows each connection’s NAME, PROVIDER, GitHub ACCOUNT, EXPIRES and STATE, which is connected, pending or needs consent. delete revokes the token at GitHub for a connection stored in Ringleader. For a connection held on your computer, it removes only the local copy and does not revoke the GitHub grant.

Connect without a Ringleader login

You can connect while logged out, for workstations on your own computer. The Ringleader daemon then holds and renews the connection on that computer, and the token stays there. Only tokens that act as you work this way. A token that acts as the app needs your Ringleader deployment, so an Integration that asks for one adds no key on those workstations.

For a connection held on your computer, delete removes the local copy. You do not need to revoke the GitHub grant. If you revoke it at https://github.com/settings/applications, GitHub disconnects every Ringleader connection for this app.

Connect a service account

Add --service-account <namespace>/<name> to the connect command to connect a GitHub account for a service account instead of for you, usually a GitHub bot account. You need to be allowed to update the service account. Its workstations then act as that GitHub account. List and remove its connections with rl serviceaccount authorization list <account> and rl serviceaccount authorization delete <account> <name>.

Troubleshoot

The browser page explains why an install did not link or what happens next. The command prints the same sentence after an install ends, or says it timed out. An owner request does not end the install, so the command keeps waiting until it times out.

  • If the command says “this control plane has no GitHub App configured”, ask whoever runs your Ringleader deployment.
  • If the page says “Only an owner of the GitHub account can link it”, start the install again and send the new link to an owner of the GitHub organization.
  • If the page says “Your GitHub account cannot see this installation”, install the app from a GitHub account that owns the organization.
  • If the page says “GitHub would not show your role in this organization”, the organization’s settings may restrict the app, for example with an IP allow list. See GitHub organization settings that block the app.
  • If the page says “GitHub did not accept this sign-in”, the sign-in code from GitHub was refused or expired. Start the install again.
  • If the page says “You can no longer link this provider”, the person who started the install lost the right to change the provider. Ask an org admin to run it.
  • If the page says “Your request went to the organization’s owners”, nothing was linked. Ask an org admin to send a Ringleader install link to an owner.
  • If the page says “This link is missing something”, start the install again.
  • If the page says “This install link has expired or was already used”, start the install again for a new link.
  • If the page says “Nothing was linked”, someone pressed Don’t link. The app stays installed on GitHub until someone uninstalls it in the GitHub organization’s settings.
  • If the page says “Ringleader could not finish this install”, try again in a few minutes.

When a token is not being added, the request still reaches the service without it, and the service usually answers 401. rl integration describe <name> -n <namespace> shows each host as Injecting or Not injecting with a reason, in its Credential injection section. Reasons about one workstation’s owner show on that workstation, in the same section of rl workstation describe <name>.

  • If the reason is AuthorizationRequired, the workstation’s owner runs rl userauthorization connect GlobalCredentialProvider/github.
  • If the reason is ConsentExpired, GitHub refused to renew the owner’s connection. The owner runs the same command again.
  • If the reason is ProviderNotFound, the provider does not exist, or the Integration’s namespace cannot reach it. Check the kind and name.
  • If the reason is ProviderUseDenied, the Integration’s author no longer has use on the provider. Give it back, or have someone who has it apply the Integration.
  • If the reason is TokenUnavailable, Ringleader could not get a token for this Integration. On GitHub, check that the provider has an installation for the repositories’ owner, that the installation was granted the permissions listed, and that no list is empty.
  • If the reason is InstallationTokenNotOnDevice, the workstation runs only on your computer with no login, and the Integration asks for the app’s token. Use userAuthorization: boxOwner, or log in.
  • If the reason is EdgeCannotRenew, the Edge’s agent cannot ask for a new token, so it is given none. Update the Edge’s agent.

Next steps