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