GH-REPO-SET-DEFAULT(1)
π GH-REPO-SET-DEFAULT(1) β the GitHub CLI manual, bestie edition π
okay so you're reading the manual page for gh-repo-set-default from the GitHub CLI manual, and honestly? it's a glow-up moment for your local clone. let's get into it β¨
πΈ NAME πΈ
gh-repo-set-default β configure the default repository for this directory π«Ά
β¨ SYNOPSIS β¨
gh repo set-default [<repository>] [flags]
π DESCRIPTION π
so basically this command sets the default remote repository that gets used when you're querying the GitHub API for the repo you've got cloned locally. it's the "who am I talking to" of your directory, and it ate. π
gh uses that 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. not me being the one thing this command doesn't do π keep that in mind, fr fr.
π¦ OPTIONS π¦
-u,--unsetβ unset the current default repository, bye bestie π-v,--viewβ view the current default repository, just a lil peek π
β EXIT CODES β
0: successful execution β slay, it worked π1: error β something went sideways π2: command canceled β you changed your mind, valid πΈ4: authentication required β you gotta log in first, no cap π
NOTE: specific commands may have additional exit codes. refer to the command's help for more information. iykyk π
π 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
like, the last one is such a hack bestie β add a remote first and the interactive picker has more options to offer you. main character energy. π§
π SEE ALSO π
and that's the whole vibe check π this was the GitHub CLI v2.102.0 manual page, dated Oct 2026 β go set that default repo, you absolute icon. periodt. π₯π
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms