# gh config set: Configure gh Behavior in CI

> gh config set changes gh CLI settings like git_protocol, pager, and prompt. Reference for --host, the prompt-disabled case, and CI-friendly defaults.

Source: https://latchkey.dev/learn/command-reference/gh-config-set  
Updated: 2026-06-30

gh config set changes a gh CLI configuration value such as the git protocol, pager, or prompt setting.

On a runner you usually want gh non-interactive and pager-free; gh config set adjusts those defaults once at the start of a job.

## What it does

gh config set writes a key-value pair into the gh configuration. Useful keys include git_protocol (https or ssh), prompt (enabled or disabled), and pager. --host scopes the setting to a specific GitHub host.

## Common usage

```Terminal
gh config set prompt disabled
gh config set git_protocol https
gh config set pager cat
gh config set git_protocol ssh --host github.example.com
```

## Flags

| Key / Flag | What it does |
| --- | --- |
| prompt <enabled|disabled> | Toggle interactive prompts |
| git_protocol <https|ssh> | Protocol gh uses for git operations |
| pager <program> | Pager to use (cat disables paging) |
| editor <program> | Default editor for gh |
| -h, --host <host> | Scope the setting to a GitHub host |

## In CI

Most prompts are already suppressed when no TTY is present, but gh config set prompt disabled makes it explicit. Set pager cat (or export GH_PAGER=cat) so long output never blocks on a pager, and pick git_protocol https when only GH_TOKEN is available.

## Common errors in CI

gh config set rarely errors, but an invalid key is silently stored and ignored, so a typo like git_protcol has no effect; verify with gh config get. A command that still hangs in CI usually means a different interactive prompt, not the pager, so also disable prompts.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### gh config set: Configure gh Behavior in CI?

On a runner you usually want gh non-interactive and pager-free; gh config set adjusts those defaults once at the start of a job.

### What it does?

gh config set writes a key-value pair into the gh configuration. Useful keys include git_protocol (https or ssh), prompt (enabled or disabled), and pager. --host scopes the setting to a specific GitHub host.

### In CI?

Most prompts are already suppressed when no TTY is present, but gh config set prompt disabled makes it explicit. Set pager cat (or export GH_PAGER=cat) so long output never blocks on a pager, and pick git_protocol https when only GH_TOKEN is available.

### Common errors in CI?

gh config set rarely errors, but an invalid key is silently stored and ignored, so a typo like git_protcol has no effect; verify with gh config get. A command that still hangs in CI usually means a different interactive prompt, not the pager, so also disable prompts.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
