All posts

Guides2 min read

A GitHub account for each remote

Bind a gh account to an HTTPS remote and fetch, pull, and push use it — without gh auth switch, and without tokens from your shell.

If gh holds more than one GitHub account — personal and work, or GitHub.com and an Enterprise host — each HTTPS remote can now authenticate as its own account. Fetch, pull, and push use the account bound to that remote, even when it isn't gh's active account. You no longer run gh auth switch before a push, and GitLane never changes which account is active.

Sign each account into gh

  1. In a terminal, run gh auth login once per account. For GitHub Enterprise, add --hostname with your host.
  2. In GitLane, open Settings → Accounts. Each account is listed there; one that gh can no longer use is marked needs re-auth.

GitLane needs gh 2.95 or newer.

Bind an account to a remote

  1. Open the repository's settings: click the identity chip in the title bar and choose Remote access settings…, or open the provider indicator and choose Manage remotes….
  2. Under Configured remotes, find the remote and open its Account picker.
  3. Choose the @login you want. Only accounts for that remote's host are listed. System git credentials removes the binding.

The binding is the username in the remote's HTTPS URL, written with git remote set-url, so it lives in the repository's git config and git remote -v shows it.

Tokens from your shell are ignored

Git operations started by GitLane no longer pick up provider tokens from the environment GitLane was launched from: GH_TOKEN, GITHUB_TOKEN, GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN, GITLAB_TOKEN, GITLAB_ACCESS_TOKEN, and OAUTH_TOKEN. If your pushes only worked because your shell exported one of these, bind the account as above instead.

The integrated terminal keeps your own environment, so commands you type there behave as they do in any terminal.

Good to know

GitLane never runs gh auth switch. For each git operation it looks up the bound account's token and hands it only to the gh credential helper — not to git, and not to your hooks.

If that lookup fails — the account was logged out of gh, say — the operation fails. It does not fall back to gh's active account. The error toast offers Fix authentication…, which opens Settings → Accounts.

SSH remotes have no account picker: your SSH key decides who you are. Cursor Origin, GitLab, Bitbucket, and other HTTPS remotes keep using your git credential helper or Git Credential Manager (GitLab goes through glab when it's signed in), and gh credentials are never sent to origin.cursor.com.

A remote with several push URLs is refused; edit those in git first.

The account only decides who authenticates. Who your commits are authored by is separate: see Accounts and identities.

Shipped in GitLane v2.3.10; shell tokens have been ignored since GitLane v2.3.7.

Installers: Download GitLane.