Skip to content

gtl env

Create or update a .envrc file that selects CLI accounts for this repository, exports Git author/committer identity for child processes and agents, and validates selected gh/glab accounts when possible. Existing GitHub accounts in the machine gh config use GH_TOKEN; pass --config-dir to use a separate GitHub CLI config directory. If a GitHub account name has a unique local match, interactive runs ask before using the matched account. Matched GitHub profiles record the canonical API login while keeping the local profile directory or token selector needed by gh. Also adds .envrc and .gtl/ to .git/info/exclude so local identity files stay untracked.

Aliases

envrc

Usage

bash
gtl env [account] [flags]
gtl env [command]

Subcommands

CommandDescription
gtl env checkVerify repo-local Git, gh, and glab identity
gtl env connectConnect repo-local CLI auth providers
gtl env deleteDelete the .envrc file
gtl env listList local GitHub auth profiles
gtl env set-gitSet repo-local Git author and committer identity
gtl env setupSetup .envrc for per-repo GitHub auth
gtl env showShow current .envrc contents

Examples

bash
gtl env work-gh
gtl env connect gh work-gh
gtl env connect glab work-glab --host gitlab.com
gtl env set-git work-bot --email [email protected]
gtl env check
gtl env show
gtl env delete

Full Help

text
Create or update a .envrc file that selects CLI accounts for this repository, exports Git author/committer identity for child processes and agents, and validates selected gh/glab accounts when possible. Existing GitHub accounts in the machine gh config use GH_TOKEN; pass --config-dir to use a separate GitHub CLI config directory. If a GitHub account name has a unique local match, interactive runs ask before using the matched account. Matched GitHub profiles record the canonical API login while keeping the local profile directory or token selector needed by gh. Also adds .envrc and .gtl/ to .git/info/exclude so local identity files stay untracked.

Usage:
  gtl env [account] [flags]
  gtl env [command]

Aliases:
  env, envrc

Examples:
gtl env work-gh
gtl env connect gh work-gh
gtl env connect glab work-glab --host gitlab.com
gtl env set-git work-bot --email [email protected]
gtl env check
gtl env show
gtl env delete

Available Commands:
  check       Verify repo-local Git, gh, and glab identity
  connect     Connect repo-local CLI auth providers
  delete      Delete the .envrc file
  list        List local GitHub auth profiles
  set-git     Set repo-local Git author and committer identity
  setup       Setup .envrc for per-repo GitHub auth
  show        Show current .envrc contents

Flags:
      --allow-new-account   Skip logged-in account validation for a new GitHub account
      --config-dir string   GitHub CLI config directory to set as GH_CONFIG_DIR
      --git-email string    Git user.email to set locally (defaults to GitHub public email when available)
      --git-name string     Git user.name to set locally (defaults to GitHub name/login)
  -h, --help                help for env
      --host string         GitHub host (default: github.com) (default "github.com")
      --no-git-identity     Do not set local Git commit identity
      --token               Use GH_TOKEN from 'gh auth token --user <account>' instead of GH_CONFIG_DIR

Use "gtl env [command] --help" for more information about a command.

Released under the MIT License.