The `huggingface-cli repo create` command is used to create new repositories (models, datasets, or Spaces) on the Hugging Face Hub directly from your command line.
huggingface-cli repo create [--name REPO_NAME] [--type {model,dataset,space}] [--organization ORGANIZATION] [--private] [--token HF_TOKEN]* `--name REPO_NAME`: (Required) The name of the repository to create. If not provided, the CLI will prompt you to enter it.
* `--type {model,dataset,space}`: (Optional) The type of repository. Can be `model` (default), `dataset`, or `space`. This determines the namespace and default visibility/features on the Hugging Face Hub.
* `--organization ORGANIZATION`: (Optional) The name of the organization under which to create the repository. If omitted, the repository will be created under your personal user account.
* `--private`: (Optional) If specified, the repository will be created as private. By default, repositories are public.
* `--token HF_TOKEN`: (Optional) Your Hugging Face Hub API token. If not provided, the CLI will use the token stored locally after `huggingface-cli login` or prompt you to log in.
1. **Create a new public model repository under your personal account:**
huggingface-cli repo create --name my-awesome-modelThis will create `your-username/my-awesome-model` on the Hugging Face Hub.
2. **Create a new public dataset repository:**
huggingface-cli repo create --name my-new-dataset --type datasetThis creates `your-username/my-new-dataset` as a dataset repository.
3. **Create a private Space repository:**
huggingface-cli repo create --name my-secret-space --type space --privateThis creates a private Space named `your-username/my-secret-space`.
4. **Create a public model repository under an organization:**
huggingface-cli repo create --name team-model-v1 --organization my-org --type modelThis creates `my-org/team-model-v1` on the Hub. You must be an admin of `my-org` to do this.
5. **Create a repository interactively (without specifying --name):**
huggingface-cli repo create --type datasetThe CLI will then prompt you to enter the repository name:
> Repo name: my-interactive-datasetThe `repo create` command streamlines the process of initializing a new repository on the Hugging Face Hub. Instead of navigating the website, you can quickly set up your project's home directly from your terminal.
* **Repository Types**: Choosing the correct `--type` is important because it dictates the default layout, associated features (e.g., dataset viewer for `dataset` repos, live demo for `space` repos), and how the repository is indexed on the Hub.
* **Personal vs. Organization**: If you're working in a team, using the `--organization` flag is crucial for collaborative projects, ensuring the repository is managed under the organization's account.
* **Public vs. Private**: The `--private` flag allows you to keep your work confidential until you're ready to share it. Private repositories are only accessible to you and members of your organization (if created under one).
* **Authentication**: The command relies on your authentication token. Ensure you've logged in using `huggingface-cli login` or provide a valid token via the `--token` argument. Without proper authentication, you won't be able to create repositories.
After creation, you can clone the repository to your local machine using Git and push your files. For example, after creating `your-username/my-awesome-model`:
git clone https://huggingface.co/your-username/my-awesome-model
cd my-awesome-model
echo "My model files go here" > README.md
git add .
git commit -m "Initial commit"
git push