GH-REPO-SET-DEFAULT(1) GitHub CLI manual GH-REPO-SET-DEFAULT(1)

# [NAME](#NAME)

gh-repo-set-default - Configure default repository for this directory

# [SYNOPSIS](#SYNOPSIS)

**gh repo set-default \[&lt;repository&gt;] \[flags]**

# [DESCRIPTION](#DESCRIPTION)

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.](#NOTE:_gh_does_not_use_the_default_repository_for_managing_repository_and_environment_secrets.)

# [OPTIONS](#OPTIONS)

[**-u**, **--unset**](#u)

Unset the current default repository

[**-v**, **--view**](#v)

View the current default repository

# [EXIT CODES](#EXIT_CODES)

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.

# [EXAMPLE](#EXAMPLE)

```
# 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
```

# [SEE ALSO](#SEE_ALSO)

[**gh-repo(1)**](/man/os/gh/gh-repo.1)

Oct 2026

---

Document: gh-repo-set-default(1) from gh 2.103.2-r0 (Chainguard OS)
Source: https://github.com/cli/cli
