Use several GitHub identities on one workstation
Let one workstation act as more than one GitHub account or app, and choose the identity for each request, while none of their tokens is on the workstation.
Let one workstation act as more than one GitHub account or app, and choose the identity for each request, while none of their tokens is on the workstation. Use this when you push your own work as yourself and let a coding agent open pull requests as a bot account, or when two GitHub Apps each reach different repositories. Each identity is its own GitHub Integration. A request names the one it wants with a placeholder, and Ringleader adds that Integration’s token as the request leaves the workstation.
Prerequisites
- Ringleader installed, with the Ringleader application running.
- The workstation and Integration from
Give a workstation access to GitHub: a workstation on
your computer named
my-git-box, labeledrole: agent, and the Integrationmy-githubthat adds your token. Replace the names with yours. - A GitHub personal access token for the second identity, such as a bot account, that can read the repository you clone below.
git2.46 or later on the workstation for thegitstep. Debian 13, the default image, has a newer one, and Ubuntu 24.04 has 2.43. Rungit --versionon the workstation to check.
Add a second identity
Store the second token in a Secret, then apply a second GitHub Integration. Your first Integration stays the default, so a request that names no identity keeps using your own token.
Store the token in a Secret named
github-bot-pat:rl secret create github-bot-pat -n local --from-string token=<bot-token>Save this as
my-github-bot.yaml. It reaches the same workstations asmy-github, anddefault: falsemakes it answer only requests that name it:apiVersion: workstations.ringleader.dev/v1 kind: Integration metadata: name: my-github-bot namespace: local spec: type: httpProxy selector: matchLabels: role: agent httpProxy: vendor: github default: false credentialRef: name: github-bot-pat key: tokenApply the file:
rl apply -f my-github-bot.yamlWait until the workstation has applied it:
rl workstation wait my-git-box --for Configured --timeout 10m -n localThe command returns once the workstation’s
Configuredcondition isTrue.
Choose an identity for a request
Each GitHub Integration has a placeholder: rlsel- followed by the Integration’s name. The
placeholder for my-github-bot is rlsel-my-github-bot. When a request to GitHub carries a
placeholder in its Authorization header, Ringleader replaces the whole header with that
Integration’s token. A request with no placeholder gets the default Integration’s token, here
my-github’s.
These steps make one request with each tool, as the bot account:
Open a shell on the workstation:
rl shell my-git-box -n localCall the GitHub API with
curl, sending the placeholder as a bearer token:curl -H "Authorization: Bearer rlsel-my-github-bot" https://api.github.com/userThe response’s
loginis the bot account. The same call without the header returns your own account.Optional: Call the API with the GitHub CLI, if the workstation has the
ghdevtool.ghsends the value ofGH_TOKENin itsAuthorizationheader:GH_TOKEN=rlsel-my-github-bot gh api user --jq .loginThe command prints the bot account’s login.
Clone a repository with
git, with the placeholder as the password in the URL:git clone https://my-github-bot:rlsel-my-github-bot@github.com/your-org/your-app.gitThe clone runs as the bot account.
gitsaves this URL as the repository’s remote, so a latergit pushorgit pullin that folder runs as the bot account too. Agit clonewith no placeholder in the URL still runs as you.
If that is all you need, you are done. The sections below say where to find a placeholder, how to choose the default identity, and what to do when a request does not use the identity you expect.
Find an Integration’s placeholder
Ringleader shows each GitHub Integration’s placeholder, and whether it is the default, in three places:
rl integration describe my-github-bot -n localprints them underStatus:Status: Default: false GeneratedConfig: integration-my-github-bot Placeholder: rlsel-my-github-botIn the Ringleader console, the page of an Integration in one of your namespaces shows Placeholder and Default rows.
On the workstation,
/etc/ringleader/integrations/my-github-bot.jsonholds them for a program to read. The workstation’s login user androotcan read the file:{ "schemaVersion": 1, "name": "my-github-bot", "namespace": "local", "type": "httpProxy", "vendor": "", "httpProxy": { "vendor": "github", "placeholder": "rlsel-my-github-bot", "default": false, "hosts": [ "api.github.com", "github.com", "raw.githubusercontent.com" ], "gitHost": "github.com" } }
A placeholder is not a secret. You can put it in a script, an environment variable or a log. It picks a token only on a workstation the Integration already reaches, and every program on such a workstation can already use that token. On any other workstation it picks nothing.
Choose the default identity
httpProxy.default says whether an Integration’s token goes on requests that carry no placeholder,
such as a plain git clone or curl. It is true when you leave it out, and it is accepted only
beside vendor: github. Keep exactly one GitHub Integration as the default on each workstation, and
set default: false on the others.
If two GitHub Integrations that reach one workstation are both the default, neither is. A request
with no placeholder goes to GitHub with no token, so cloning a private repository fails or asks for
a password. A request with a placeholder still gets its Integration’s token. It gets none if the
edge instance, edge VM or network process that serves the workstation runs a Ringleader version
older than placeholders. Ringleader reports the clash as DefaultContested:
rl workstation describe my-git-box -n locallists each GitHub host under Credential injection as not injecting, and says that another Integration also claims to be the default.rl integration describe <name>says the same for each of the two Integrations when an Edge your namespace declares serves the workstation, as one serves every cloud workstation. For a workstation on your computer with no Edge declared, only the workstation reports it.
The workstation keeps working, and no condition changes. To fix it, set default: false on one of
the two Integrations and apply it again.
An Integration with default: false writes no gh configuration, even when it lists
toolconfigs: [{name: gh}]. When several GitHub Integrations write one, gh uses the placeholder of
the Integration whose name sorts last, which might not be the default.
A gh tool configuration in a WorkstationConfig of your own can replace the Integrations’ gh
configuration. Which one wins depends on your WorkstationConfig’s priority, compared with the -100
that every Integration’s generated configuration has.
Layer merge order
explains priorities.
- Above -100, your WorkstationConfig wins. Leaving
priorityout puts it above -100, whether you attach it by label or list it in the workstation’sspec.configs.ghthen sends your configuration’s token and no placeholder, so Ringleader treats its requests like any other request with no placeholder. - Below -100, the Integrations win.
- At exactly -100, a WorkstationConfig you list in the workstation’s
spec.configsloses. One attached by label wins only when its name sorts after theGeneratedConfigname of every Integration that writes aghconfiguration.rl integration describeshows that name.
To be sure which identity gh uses for a command, set GH_TOKEN to its placeholder, as step 3 of
Choose an identity for a request shows.
Troubleshoot
If a
git clonewith a placeholder in its URL runs as your default identity, checkgit --versionon the workstation.gitolder than 2.46, such as the 2.43 that Ubuntu 24.04 ships, sends no credential until GitHub asks for one. Ringleader adds the default’s token first, so GitHub never asks. Usegit2.46 or later, or useghorcurlwith the placeholder. Settingdefault: falseon every GitHub Integration also works, because GitHub then asks andgitsends the URL’s placeholder, but agit clonewith no placeholder then has no token at all.If the same happens on a cloud workstation with
git2.46 or later, the edge instance that serves the workstation may run a Ringleader version older than placeholders. An edge instance that old adds the default’s token whatever the request carries, soghandcurlwith the placeholder also run as your default identity.rl integration describe my-github-botthen says under Credential injection that the placeholder entry is not honored. Ringleader updates the edge instance for you. If the Edge has maintenance windows, the update can wait for the next one.If the same happens with
git2.46 or later, butcurlwith the placeholder, orghwithGH_TOKENset to it, runs as the bot account, check whetherXDG_CONFIG_HOMEis set in a shell on the workstation:echo "$XDG_CONFIG_HOME"Ringleader writes the settings that make
gitsend the URL’s placeholder under~/.config/git/. If the command prints nothing, the variable is not set and this is not the cause. If it prints a folder other than~/.config,gitreads its settings from that folder and skips Ringleader’s. Choose one fix:- Remove the variable, or set it to the full path of
~/.config, such as/home/dev/.config. Then open a new shell. The variable comes from anenvironmententry in the workstation or a WorkstationConfig, or from your own shell startup files. Other programs also keep their settings in the folder it names, so once you remove it they look in~/.configinstead. - Leave the variable as it is, and use
curlwith the placeholder, orghwithGH_TOKENset to it, to act as the bot account.
- Remove the variable, or set it to the full path of
If a request gets a
403saying that the credential selector is unknown, its value starts withrlsel-but names no GitHub Integration that reaches this workstation. The request never reaches GitHub. Check the spelling againstrl integration describe, and check that the workstation carries the labels in the Integration’s selector.If a request with a placeholder runs as your default identity whatever the tool, or GitHub answers
401, on a workstation on your computer with no Edge declared, the workstation’s network process may be from a Ringleader version older than placeholders. Restart the workstation, which starts that process again:rl workstation restart my-git-box -n local
Next steps
- Injected credentials explains how Ringleader adds a token outside the workstation, and where it works.
- Injection fields lists every
field of a GitHub Integration,
defaultincluded. - Connect workstations to GitHub with the Ringleader GitHub App gets a short-lived token from a GitHub App, in place of a personal access token.