Files
docs/cli-docs/reference/help/environment.md
T
bircni 55c3a392a1 feat: generate the gt command reference from gitea/cli
update_cli_docs.sh runs gt's own generator and lays the pages out for the
site: one directory per command group, front matter, titles, sidebar
order, fenced help text and rewritten links. --released succeeds while no
series is documented. A weekly workflow proposes updates like the runner's.

Signed-off-by: bircni <[email protected]>
2026-10-22 11:28:15 +02:00

4.7 KiB

sidebar_position, description
sidebar_position description
1 Environment variables and global flags

gt help environment

Environment variables and global flags

Synopsis

Global flags work with every command, before or after the command name:

      --cwd directory     Working directory for repository discovery
      --debug             Log the method, URL, status, and duration of each HTTP request to stderr
      --host URL          Gitea instance URL, including any base path
      --interactive       Allow prompts with machine output
  -q, --jq expression     Filter JSON output using a jq expression; implies --json
      --json fields       Output JSON with the specified comma-separated fields, or all fields
      --no-input          Disable prompts and implicit editor/browser interactions
      --remote remote     Git remote used for repository discovery
  -R, --repo OWNER/REPO   Select a repository as OWNER/REPO or URL
      --sudo user         Perform API requests as this user (requires an administrator account)
      --user name         Account name on the selected instance
  -y, --yes               Accept confirmations without prompting

gt selects the repository from --repo, GITEA_CLI_REPO, git config gt.repository (gt repo
set-default) or a Git remote (--remote, else the base remote pr checkout recorded, the
current branch's remote, upstream or origin, skipping remotes on instances without an
account, or not on --host or the GITEA_TOKEN instance). Like gh, a clone with upstream
and origin targets upstream: a branch tracking origin does not select the fork,
and the instance from the repository URL, --host, GITEA_CLI_HOST or GITEA_INSTANCE_URL,
default_host, the only configured instance, or, among several, the instance of the clone's
repository.

Environment variables:

  GITEA_CLI_CONFIG_DIR                configuration directory; gt config path prints the files
  GITEA_CLI_HOST, GITEA_INSTANCE_URL  instance URL, overriding default_host
  GITEA_TOKEN                         access token for that instance instead of stored credentials
  GITEA_INSTANCE_INSECURE             with GITEA_TOKEN, skip TLS verification when true
  GITEA_INSTANCE_SSH_HOST             with GITEA_TOKEN, SSH host that identifies the instance's remotes
  GITEA_CLI_USER                      account on the selected instance, like --user
  GITEA_CLI_REPO                      repository as OWNER/REPO or URL, like --repo
  GITEA_CLI_EDITOR                    editor, overriding config.yml
  GITEA_CLI_PAGER                     pager, overriding config.yml
  GITEA_CLI_COLOR                     color preference: auto, always or never
  GITEA_CLI_HTTP_TIMEOUT              longest wait for an answer, overriding config.yml
  NO_COLOR                            disables automatic color when set, even with CLICOLOR_FORCE
  CLICOLOR_FORCE                      unless empty or 0, colors stderr, even when redirected, and
                                      a terminal stdout despite CLICOLOR=0 or TERM=dumb
  CLICOLOR                            disables automatic color on a terminal when 0
  VISUAL, EDITOR, PAGER, BROWSER      editor (VISUAL first), pager and browser when config.yml sets none
  TERM                                dumb asks each prompt as a line of text, for screen readers,
                                      and turns off automatic color

Piped or redirected stdout is data: the color settings never color it. Only a
command's own --color always does, such as gt pr diff --color always.

Preferences in config.yml are described in gt config --help.

Options

  -h, --help   help for environment

Options inherited from parent commands

      --cwd directory       Working directory for repository discovery
      --debug               Log the method, URL, status, and duration of each HTTP request to stderr
      --host URL            Gitea instance URL, including any base path
      --interactive         Allow prompts with machine output
  -q, --jq expression       Filter JSON output using a jq expression; implies --json
      --json fields[="*"]   Output JSON with the specified comma-separated fields, or all fields
      --no-input            Disable prompts and implicit editor/browser interactions
      --remote remote       Git remote used for repository discovery
  -R, --repo OWNER/REPO     Select a repository as OWNER/REPO or URL
      --sudo user           Perform API requests as this user (requires an administrator account)
      --user name           Account name on the selected instance
  -y, --yes                 Accept confirmations without prompting

SEE ALSO

  • gt: Work with Gitea from your terminal