How Can We Help?
Using the gh Command with GitHub
The gh command enables you to work more speedily with GitHub.
To create a new GitHub repository:
gh repo create
gh repo create [<name>] [flags]
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.
Examples for using gh
# create a repository interactively
gh repo create
# create a new remote repository and clone it locally
gh repo create my-project –public –clone
# create a remote repository from the current directory
gh repo create my-project –private –source=. –remote=upstream
Options
–add-readme
Add a README file to the new repository
-c, –clone
Clone the new repository to the current directory
-d, –description <string>
Description of the repository
–disable-issues
Disable issues in the new repository
–disable-wiki
Disable wiki in the new repository
-g, –gitignore <string>
Specify a gitignore template for the repository
-h, –homepage <URL>
Repository home page URL
–include-all-branches
Include all branches from template repository
–internal
Make the new repository internal
-l, –license <string>
Specify an Open Source License for the repository
–private
Make the new repository private
–public
Make the new repository public
–push
Push local commits to the new repository
-r, –remote <string>
Specify remote name for the new repository
-s, –source <string>
Specify path to local repository to use as source
-t, –team <name>
The name of the organization team to be granted access
-p, –template <repository>
Make the new repository based on a template repository
gh
Work seamlessly with GitHub from the command line.
USAGE
gh <command> <subcommand> [flags]
CORE COMMANDS
browse: Open the repository in the browser
codespace: Connect to and manage your codespaces
gist: Manage gists
issue: Manage issues
pr: Manage pull requests
release: Manage GitHub releases
repo: Create, clone, fork, and view repositories
ACTIONS COMMANDS
actions: Learn about working with GitHub Actions
run: View details about workflow runs
workflow: View details about GitHub Actions workflows
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
auth: Login, logout, and refresh your authentication
completion: Generate shell completion scripts
config: Manage configuration for gh
extension: Manage gh extensions
gpg-key: Manage GPG keys
help: Help about any command
secret: Manage GitHub secrets
ssh-key: Manage SSH keys
FLAGS
–help Show help for command
–version Show gh version
EXAMPLES
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
ENVIRONMENT VARIABLES
See ‘gh help environment’ for the list of supported environment variables.
LEARN MORE
Use ‘gh <command> <subcommand> –help’ for more information about a command.
Read the manual at https://cli.github.com/manual