gh repo

Work with GitHub repositories

Subcommands

NameDescription
archiveArchive a GitHub repository. With no argument, archives the current repository
cloneClone a GitHub repository locally. If the "OWNER/" portion of the "OWNER/REPO" repository argument is omitted, it defaults to the name of the authenticating user. Pass additional 'git clone' flags by listing them after '--'
createCreate a new GitHub repository. To create a repository interactively, use 'gh repo create' with no arguments. To create a remote repository non-interactively, supply the repository name and one of '--public', '--private', or '--internal'. Pass '--clone' to clone the new repository locally. To create a remote repository from an existing local repository, specify the source directory with '--source'. By default, the remote repository name will be the name of the source directory. Pass '--push' to push any local commits to the new repository
deploy-keyManage deploy keys in a repository
deleteDelete a GitHub repository. With no argument, deletes the current repository. Otherwise, deletes the specified repository. Deletion requires authorization with the "delete_repo" scope. To authorize, run "gh auth refresh -s delete_repo"
editEdit repository settings
forkCreate a fork of a repository. With no argument, creates a fork of the current repository. Otherwise, forks the specified repository. By default, the new fork is set to be your 'origin' remote and any existing origin remote is renamed to 'upstream'. To alter this behavior, you can set a name for the new fork's remote with --remote-name. Additional 'git clone' flags can be passed in by listing them after '--'
listList repositories owned by user or organization. For more information about output formatting flags, see 'gh help formatting'
renameRename a GitHub repository. By default, this renames the current repository; otherwise renames the specified repository
set-defaultSets the default remote repository to use when querying the GitHub API for the locally cloned repository
syncSync destination repository from source repository. Syncing uses the main branch of the source repository to update the matching branch on the destination repository so they are equal. A fast forward update will be used execept when the '--force' flag is specified, then the two branches will by synced using a hard reset. Without an argument, the local repository is selected as the destination repository. The source repository is the parent of the destination repository by default. This can be overridden with the '--source' flag
viewDisplay the description and the README of a GitHub repository. With no argument, the repository for the current directory is displayed. With '--web', open the repository in a web browser instead. With '--branch', view a specific branch of the repository. For more information about output formatting flags, see 'gh help formatting'