gh-repo-set-default(1)

gh-repo-set-default1

Configure default repository for this directory

Usage

gh repo set-default [<repository>] [flags]

Overview

This command sets the default remote repository to use when querying the GitHub API for the locally cloned repository.

gh uses the default repository for things like:

•

viewing and creating pull requests

•

viewing and creating issues

•

viewing and creating releases

•

working with GitHub Actions

NOTE: gh does not use the default repository for managing repository and environment secrets.

Options

-u, --unset

Unset the current default repository

-v, --view

View the current default repository

Exit status

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

Examples

# Interactively select a default repository
$ gh repo set-default
# Set a repository explicitly
$ gh repo set-default owner/repo
# Set a repository using a git remote name
$ gh repo set-default origin
# View the current default repository
$ gh repo set-default --view
# Show more repository options in the interactive picker
$ git remote add newrepo https://github.com/owner/repo
$ gh repo set-default

Releases

3 releases since Debian 12 (Bookworm); the text changed 2 times.

  1. 12
  2. 13
  3. Arch

From github-cli 2.102.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.