hub-create
Create a new GitHub repository
TLDR
Upload the current (local-only) repository to your GitHub account as public
Create a private repository and open the new repository in a web browser
SYNOPSIS
hub create [REPOSITORY_NAME] [OPTIONS]
hub create ORGANIZATION/REPOSITORY_NAME [OPTIONS]
PARAMETERS
REPOSITORY_NAME
The name of the repository to create. If omitted, the name of the current directory is used.
ORGANIZATION/REPOSITORY_NAME
Create the repository under a specific GitHub organization.
-p, --private
Create a private repository.
-o, --public
Create a public repository (this is the default behavior).
-d DESCRIPTION, --description DESCRIPTION
Specify the repository description.
-h HOMEPAGE, --homepage HOMEPAGE
Specify the repository homepage URL.
-r REMOTE_NAME, --remote REMOTE_NAME
Add a Git remote for the new repository with the specified name. Default is origin.
-s NAME, --team NAME
Make the repository visible to a specific team within an organization.
--push
Push the current Git HEAD to the newly created GitHub repository.
--autoinit
Initialize the new repository with a default README.
--autoinit --license LICENSE
Auto-initialize with a specified open-source license.
--autoinit --gitignore TEMPLATE
Auto-initialize with a .gitignore file based on a template.
--template REPOSITORY
Initialize the new repository using a template repository.
-t TOPICS, --topic TOPICS
Add topics (comma-separated) to the new repository.
DESCRIPTION
hub create is a powerful subcommand of hub, a popular command-line tool that extends Git with GitHub-specific functionalities. It streamlines the process of creating new repositories directly on GitHub.
When invoked in an existing Git repository, it creates a new GitHub repository for it and automatically sets up the origin remote. Alternatively, you can specify a repository name to create an empty GitHub repository, which can then be cloned or pushed to. This command significantly simplifies the initial setup of new projects on GitHub, eliminating the need to navigate the web interface. It supports various options for configuring the repository, such as setting privacy, description, homepage, and even auto-initializing with a license or .gitignore file.
CAVEATS
Requires hub to be installed and correctly configured with your GitHub credentials (e.g., via a personal access token or OAuth token).
If creating a repository for the current directory without providing a REPOSITORY_NAME, the command assumes the current directory is already a Git repository and will attempt to push its contents.
Interaction with GitHub's API is subject to rate limiting.
Creating repositories under an organization requires appropriate permissions.
AUTHENTICATION
hub authenticates with GitHub primarily by looking for a configured github.user and github.token in your Git configuration, or by prompting for credentials if necessary. It can also utilize environment variables like GITHUB_TOKEN.
DEFAULT BEHAVIOR
When hub create is run without any arguments in a Git repository, it creates a new GitHub repository with the same name as the current directory and automatically sets up the origin remote to point to it.
PUSHING EXISTING CONTENT
The --push option is crucial for projects that already have local commits. It not only creates the remote repository but also pushes the current branch's commits to it, making your local work immediately available on GitHub.
HISTORY
The hub project, from which hub-create originates, was initially developed by Mislav Marohnić. It emerged as a solution to enhance the Git command-line experience with GitHub-specific functionalities, long before the official GitHub CLI (gh) existed. hub-create specifically addressed the common need to quickly provision a new GitHub repository from the terminal, integrating seamlessly with local Git workflows. Its development reflects the increasing demand for command-line automation in web-based developer platforms. hub continues to be a widely used tool for those who prefer to manage their GitHub interactions directly from the terminal.
SEE ALSO
hub(1), git(1), hub-remote(1), hub-browse(1)