Skip to main content

Command referencegh config

gh config command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

What it does

Get or set GitHub CLI configuration values such as git protocol and prompt behavior. When people search for gh config set, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.

Get or set GitHub CLI configuration values such as git protocol and prompt behavior.

Syntax

gh config <get|set|list> [key] [value]

Common options

Flag / optionMeaning
listPrint all configuration keys and values.
get KEYPrint one configuration value.
set KEY VALUEWrite a configuration value.
git_protocolCommon key: https or ssh.
promptEnable or disable interactive prompts.

Practical examples

List config

gh config list

Shows current gh configuration entries.

Prefer HTTPS

gh config set git_protocol https

Makes clone/fetch remotes use HTTPS by default.

Read a key

gh config get git_protocol

Prints the configured git protocol.

Disable prompts

gh config set prompt disabled

Useful in non-interactive scripts that must not hang.

Common mistakes

  • Setting protocol after remotes already exist and expecting old remotes to rewrite themselves.
  • Disabling prompts globally and then wondering why interactive commands fail.

FAQ

What does gh config do in GitHub CLI?

Get or set GitHub CLI configuration values such as git protocol and prompt behavior.

Does gh config work on Windows and Linux?

Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.

What is a practical gh config example?

Try `gh config list` — Shows current gh configuration entries.

Do I need a token in the command line for gh config?

Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.