Skip to content

CLI reference

hangar is one binary for the server and the client. Client commands talk to an Instance through the Hub API and the native API; admin commands work on an Instance's database and Blob store directly.

Every client command takes --url, --token and --json. Without --url and --token, they use the login saved by hangar login, or the HANGAR_CLI_URL and HANGAR_CLI_TOKEN environment variables.

Exit codes

Code Meaning
0 Success.
1 An error.
2 A usage error, such as a missing argument or an unknown flag.
3 Not found, such as a Repo or a file.
4 An authentication error: not signed in, or the Token is not allowed.

hangar admin

Administer an Instance directly through its database and Blob store.

Subcommands:

hangar admin backup

Back up the database and the Blob store to a folder.

Writes a backup folder: manifest.json, every database table as JSON Lines in
db/, and every Blob store object in blobs/ under its key. Staging objects
(tmp/, uploads/ and exports/) are left out.

The database is read in one transaction, so it is consistent. Objects are
copied after it; LFS objects and git packs never change once written, and
garbage collection keeps unreferenced objects for gc.grace_period, so every
object the database references is in the backup.

With SQLite, stop Hangar first: only one process may open the database. With
Postgres, the backup can run while Hangar is running. With --skip-blobs, back
up the Blob store with the storage's own tools instead (for example bucket
replication or a filesystem snapshot).

Usage:

hangar admin backup [flags]

Examples:

hangar admin backup --output /backups/hangar-$(date +%F)
hangar admin backup --output /backups/db-only --skip-blobs

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
-o, --output folder to write the backup to; must not exist or be empty
--set set a configuration key, such as --set database.dsn=... (repeatable)
--skip-blobs back up the database only

hangar admin create-user

Create a local user.

Creates a local user with a personal Namespace. The password is read from
standard input with --password-stdin, or generated and printed once.

Usage:

hangar admin create-user <username> [flags]

Flags:

Flag Description Default
--admin make the user an Instance admin
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--display-name the user's display name
--email the user's email address
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--password-stdin read the password from standard input instead of generating one
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar admin doctor

Check the configuration, database, Blob store, presigned URLs, clock and git.

Runs the same kind of checks as the readiness endpoint, with more detail:
the configuration, the database connection and schema version, the clock
against the database, a write, read and delete in the Blob store, presigned
downloads on S3, and the git version. Exits with 1 if any check fails.

With --large-read, it also writes an object of that size (1100 MiB if no
size is given) to the Blob store and reads it back in one request at
16 MiB/s, more slowly than the store sends, as Hangar does when it checks
a large upload on a small server. A proxy in front of the store that cuts
long reads, such as nginx with its default proxy_max_temp_file_size of
1024 MiB, fails this check. It takes over a minute at the default size
and deletes the object afterwards.

Usage:

hangar admin doctor [flags]

Examples:

hangar admin doctor --config /etc/hangar/hangar.yaml
hangar admin doctor --config /etc/hangar/hangar.yaml --large-read
hangar admin doctor --config /etc/hangar/hangar.yaml --large-read=3GiB

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--large-read also write an object of this size and read it back slowly in one request, to find a proxy that cuts long reads
--set set a configuration key, such as --set database.dsn=... (repeatable)

hangar admin gc

Collect garbage: unreferenced LFS objects and unused git data.

Deletes LFS objects no Repo has referenced for gc.grace_period, orphaned
blobs, retired and orphaned packs, git data of purged Repos, stale
temporary files and abandoned uploads, then reports what it freed. It runs
in this process; with --queue it queues a gc Job for the Instance's workers
instead, which needs a running Instance on Postgres.

Usage:

hangar admin gc [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--git collect git data only
--json print JSON instead of text
--lfs collect LFS objects only
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--queue queue a gc Job for the Instance's workers instead of running it here
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar admin migrate

Apply database migrations.

Applies every pending migration. The Helm chart runs it in a pre-install and pre-upgrade Job, or in an init container of each web and worker Pod. Migrators that start together wait for one another. With --wait-for-database, it also waits for a Postgres server that does not answer yet, such as one whose Pod is still starting.

Usage:

hangar admin migrate [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)
--wait-for-database how long to keep trying to connect while a Postgres database does not answer (0 fails at once) 0s

hangar admin reindex

Index and scan Repos again.

Queues index and scan Jobs for the head of every branch of the named Repos,
or of every Repo when none is named. With --stale it queues them only for
results from an older indexer or scanner version, as workers do when they
start. The Instance's workers run the Jobs; on SQLite they run when Hangar
starts again.

Name a Repo as namespace/name, or datasets/namespace/name for a dataset.

Usage:

hangar admin reindex [repo...] [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)
--stale only results from an older indexer or scanner version
--type the type of Repo IDs without a prefix: model (the default) or dataset

hangar admin reset-password

Set a local user's password.

Sets a new password for a user, signs them out everywhere and clears
sign-in throttling, for example when the only admin is locked out. The
password is read from standard input with --password-stdin, or generated
and printed once. To let a user choose their own, create a reset link in
the admin UI instead.

Usage:

hangar admin reset-password <username> [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--password-stdin read the password from standard input instead of generating one
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar admin restore

Restore a backup made by hangar admin backup.

Restores a backup folder into the configured database and Blob store. The
database is migrated first, and must then be at the same schema version as
the backup: restore with the hangar version that made the backup, then
upgrade. The database must be empty unless --force is given, which deletes
every row first.

Rows are written in one transaction, so a failed restore leaves the database
as it was. Objects already in the Blob store with the right size are not
copied again. A backup from SQLite restores into Postgres and the other way
round, and a filesystem backup restores into S3 and the other way round.

Stop every Hangar process first.

Usage:

hangar admin restore <backup-folder> [flags]

Examples:

hangar admin restore /backups/hangar-2026-10-13
hangar admin restore /backups/hangar-2026-10-13 --set database.driver=postgres --set database.dsn=postgres://...

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--force delete every row in the database before restoring
--json print JSON instead of text
--set set a configuration key, such as --set database.dsn=... (repeatable)
--skip-blobs restore the database only

hangar admin rotate-key

Replace the Instance key and re-encrypt every stored secret.

Generates a new security.instance_key (or uses --new-key) and, in one
database transaction, re-encrypts every secret sealed with the old key:
users' upstream tokens, Upstream Instance tokens and webhook secrets.

Stop every Hangar process first: a process still running with the old key
cannot read the re-encrypted secrets. If the key came from secrets.yaml in
server.data_dir, the file is updated. Otherwise the new key is printed once;
put it in your configuration, environment or Kubernetes Secret before you
start Hangar again.

Usage:

hangar admin rotate-key [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--new-key the new key, 32 bytes base64-encoded (default: generate one)
--set set a configuration key, such as --set database.dsn=... (repeatable)

hangar config

Work with the configuration.

Subcommands:

hangar config reference

Print every configuration key with its type, default and description.

Usage:

hangar config reference [flags]

Flags:

Flag Description Default
--json print JSON instead of text

hangar config validate

Check the configuration and list every problem.

Usage:

hangar config validate [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar env

Print environment variables that point Python tools at the Instance.

Prints HF_ENDPOINT and HF_TOKEN for the current Instance, so huggingface_hub,
the hf CLI, transformers, datasets and other Hugging Face tools use Hangar.

It also prints DISABLE_SAFETENSORS_CONVERSION=1. Without it, transformers can
send the Repo ID of a model that has only pickle weights, and any Token passed
to it, to a conversion service on huggingface.co.

Usage:

hangar env [flags]

Examples:

eval "$(hangar env)"
hangar env --shell fish | source
hangar env --shell powershell | Invoke-Expression

Flags:

Flag Description Default
--json print JSON instead of a table
--shell shell syntax: bash, zsh, fish or powershell (default: from $SHELL)
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar healthcheck

Call /readyz on this host and exit 0 when ready.

Calls /readyz on the local listen address. The container image uses it as its HEALTHCHECK.

Usage:

hangar healthcheck [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json print JSON instead of text
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar import

Add models you already have on disk to the Arsenal without downloading them again.

Adds content that is already on this machine to the Arsenal. Choose one source:

  --from-hf-cache [path]   a Hugging Face cache (default ~/.cache/huggingface/hub).
                           Each Repo becomes a Mirror of the Upstream Repo with
                           the same ID: the Instance fetches its history, and
                           the CLI uploads the cached files whose SHA-256
                           matches. With --offline, or when the Upstream does
                           not have the Repo, each becomes a local Repo with
                           one Commit instead.
  --from-dir <dir>         a folder, uploaded to --repo as one Commit, as
                           hangar push does.
  --from-lmstudio [path]   LM Studio's models folder (<publisher>/<repo>/<files>).
                           Folders that match an Upstream Repo of the same name
                           become Partial mirrors; the rest become local Repos.
  --from-ollama            Ollama's models. Each model and tag becomes a local
                           Repo in your Namespace (or --namespace) with its GGUF
                           file and its template, system and params files.

Uploads go through the Instance's API, so you need write access to the
Namespaces involved. A file that fails to upload does not stop the other
files or Repos: files that went up into a Mirror are added to it, and the
results name what failed, so running the command again sends only that.
Use --dry-run to see what would be imported.

To import some models and not the rest, give --only once for each, as it
appears in the source: a Repo ID such as bartowski/Qwen2.5-7B-Instruct-GGUF
for a Hugging Face cache, a <publisher>/<repo> folder for LM Studio, or a
model and tag such as llama3.2:1b for Ollama (llama3.2 means llama3.2:latest).
Patterns can use * and ?, which do not match /, and ignore case. A pattern
that matches nothing stops the import before anything is uploaded.

Usage:

hangar import [flags]

Examples:

hangar import --from-hf-cache
hangar import --from-hf-cache /mnt/models/hf --offline --namespace acme
hangar import --from-hf-cache --only 'bartowski/*' --only Qwen/Qwen2.5-7B-Instruct --dry-run
hangar import --from-dir ./weights --repo acme/my-model
hangar import --from-lmstudio
hangar import --from-ollama --namespace acme

Flags:

Flag Description Default
--dry-run only list what would be imported
--from-dir import a folder as one Commit to --repo
--from-hf-cache import a Hugging Face cache
--from-lmstudio import LM Studio's models folder
--from-ollama import Ollama's models
--json print JSON instead of a table
--namespace Namespace for local Repos (default: the Repo's own, or yours for Ollama models)
--offline never ask the Upstream; create local Repos
--ollama-models Ollama's models folder (default: $OLLAMA_MODELS or ~/.ollama/models)
--only only import models matching this pattern, such as 'bartowski/*' or llama3.2:1b (repeatable)
--private make new local Repos private
--repo with --from-dir, the Repo to import into, such as acme/model or datasets/acme/data
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--upstream Upstream that Mirrors track huggingface
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar info

Show a Repo's metadata, files, quants, Dependencies and Arsenal state.

Shows a Repo in the Arsenal: its metadata, files (and whether each one is in
the Arsenal), GGUF quants, Dependencies and, for datasets, Configs and Splits.

If the Repo is not in the Arsenal, shows what an Upstream has instead, unless
--local is set. Repo IDs for datasets take a datasets/ prefix.

Usage:

hangar info <repo> [flags]

Examples:

hangar info bartowski/Llama-3.2-3B-Instruct-GGUF
hangar info datasets/lhoestq/demo1 --json

Flags:

Flag Description Default
--json print JSON instead of a table
--local only look in the Arsenal
--revision branch, tag or Commit SHA (default: the default branch)
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--type Repo type for IDs without a prefix: model or dataset
--upstream Upstream to ask when the Repo is not in the Arsenal huggingface
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar jobs

List, watch and cancel your Pulls and other Jobs.

Subcommands:

Flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar jobs cancel

Cancel a Job.

Usage:

hangar jobs cancel <job-id>

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar jobs list

List your Jobs, newest first.

Usage:

hangar jobs list [flags]

Flags:

Flag Description Default
--all list every Job you can see, not only yours (admins see the whole Instance)
--kind only Jobs of this kind, such as pull
--status only Jobs with this status: pending, running, succeeded, failed or cancelled

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar jobs watch

Show a Job's progress until it finishes.

Usage:

hangar jobs watch <job-id>

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar lmstudio

Install Hangar models into LM Studio.

Installs models from the Instance into LM Studio's models folder, laid out as
<namespace>/<name>/<files>. Files are downloaded once into the local Hugging
Face cache and linked into LM Studio's folder, so the disk is used once even
when Python libraries use the same model.

The models folder is --lmstudio-dir if given; otherwise the downloadsFolder in
LM Studio's settings.json, in LM Studio's home folder (the path in
~/.lmstudio-home-pointer, else ~/.cache/lm-studio, else ~/.lmstudio);
otherwise the models folder in that home folder.

Subcommands:

Flags:

Flag Description Default
--json print JSON instead of a table
--lmstudio-dir LM Studio's models folder
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar lmstudio install

Download a model and link it into LM Studio.

Downloads a model into the local cache and links it into LM Studio. For a GGUF
Repo, installs one quant group and any mmproj-*.gguf projector files; without
a quant, picks Q4_K_M, or the closest available. Other Repos, such as MLX,
are installed whole.

Usage:

hangar lmstudio install <repo>[:<quant>] [flags]

Examples:

hangar lmstudio install bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M
hangar lmstudio install mlx-community/SmolLM-135M-Instruct-4bit --link-mode copy

Flags:

Flag Description Default
--cache-dir Hugging Face cache folder (default: $HF_HUB_CACHE or ~/.cache/huggingface/hub)
--link-mode how files get into LM Studio's folder: symlink, hardlink or copy symlink
--revision branch, tag or Commit SHA (default: the default branch)

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--lmstudio-dir LM Studio's models folder
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar lmstudio list

List models installed from Hangar, and whether a newer Revision exists.

Usage:

hangar lmstudio list

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--lmstudio-dir LM Studio's models folder
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar lmstudio remove

Remove a model's links from LM Studio.

Removes the files hangar lmstudio install put in LM Studio's folder. With
--prune, also deletes the model's files from the local cache when no other
install uses them.

Usage:

hangar lmstudio remove <repo> [flags]

Flags:

Flag Description Default
--prune also delete cached files no other install uses

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--lmstudio-dir LM Studio's models folder
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar login

Sign in to an Instance and save the Token.

Signs in to an Instance. Without --token, starts a device-code login: the
browser opens a page on the Instance where you approve the code shown here,
and the Instance creates a write Token for the CLI.

The URL and username are saved in ~/.config/hangar/config.yaml. The Token is
saved in the OS keychain where one is available, otherwise in that file with
mode 0600. Pass --token - to read the Token from standard input.

Usage:

hangar login [flags]

Examples:

hangar login --url https://hangar.example.com
hangar login --url http://localhost:8080 --token hgr_xxxxxxxx
echo "$TOKEN" | hangar login --url https://hangar.example.com --token -

Flags:

Flag Description Default
--json print JSON instead of a table
--no-browser print the approval link instead of opening a browser
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar logout

Forget the saved Token.

Removes the saved Token from the OS keychain and the configuration file.
The Token itself stays valid until you revoke it in the web UI under
Settings, Tokens.

Usage:

hangar logout [flags]

Flags:

Flag Description Default
--json print JSON instead of text

hangar ollama

Install Hangar GGUF models into Ollama.

Subcommands:

Flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar ollama install

Pull a GGUF model into Ollama from the Instance.

Runs ollama pull <host>/<namespace>/<name>:<quant> against the Instance, adding
--insecure for an http:// Instance.

Before that, checks that the quant is in the Arsenal. Without a quant, Ollama
asks for "latest", which is Q4_K_M or the closest quant. Ollama shows only
"file does not exist" for a quant the Instance has not pulled, so when it is
missing this command says so, prints the hangar pull command that pulls it
into the Instance, and offers to run it (--pull runs it without asking).

Then checks that your Ollama key (~/.ollama/id_ed25519.pub) is registered with
the Instance, and offers to register it. Ollama needs the key for every Repo
unless the Repo is public and the Instance allows anonymous reads
(security.anonymous_read, off by default).

Usage:

hangar ollama install <repo>[:<quant>] [flags]

Examples:

hangar ollama install bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M
hangar ollama install bartowski/Llama-3.2-3B-Instruct-GGUF:Q8_0 --pull
hangar ollama install acme/private-model --yes

Flags:

Flag Description Default
--pull pull the quant into the Instance first, without asking, if it is not in the Arsenal
--skip-key-check do not check the Ollama key, for public Repos on an Instance that allows anonymous reads
-y, --yes register the Ollama key without asking

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar ollama key

Manage your Ollama key on the Instance.

Subcommands:

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar ollama key register

Register ~/.ollama/id_ed25519.pub with the Instance.

Usage:

hangar ollama key register

Inherited flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar pull

Pull a Repo into the Arsenal and download it to the local cache.

Makes sure the Repo, or the files you choose, are in the Arsenal: if they are
not, asks the Instance to Pull them from an Upstream and shows the progress.
Then downloads them into the local Hugging Face cache, where Python libraries
pointed at the same Instance find them, or into a folder with --to.

Choose files with a GGUF quant after a colon, --include and --exclude
patterns, or, for datasets, --config, --split and --parquet-only. With
--server-only, nothing is downloaded to this machine.

Usage:

hangar pull <repo>[:<quant>] [flags]

Examples:

hangar pull bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M
hangar pull hf-internal-testing/tiny-random-bert --include '*.json' --include '*.safetensors'
hangar pull datasets/lhoestq/demo1 --config default --split train --parquet-only --to ./data
hangar pull Qwen/Qwen3-0.6B --server-only

Flags:

Flag Description Default
--cache-dir Hugging Face cache folder (default: $HF_HUB_CACHE or ~/.cache/huggingface/hub)
--config dataset Config to Pull (repeatable)
--exclude skip files matching this pattern (repeatable)
--include only files matching this pattern, such as '*.safetensors' (repeatable)
--json print JSON instead of a table
--now start the Pull now, outside the Instance's pull windows, if allowed
--parquet-only Pull and download only the dataset's Parquet export
--revision branch, tag or Commit SHA (default: the default branch)
--server-only only Pull into the Arsenal; download nothing
--split dataset Split to Pull (repeatable)
--to download into this folder instead of the Hugging Face cache
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--track make a new Mirror follow its upstream branch
--type Repo type for IDs without a prefix: model or dataset
--upstream Upstream to Pull from when the Repo is not in the Arsenal huggingface
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar push

Upload a folder to a Repo as one Commit.

Uploads every file under a folder as one Commit. Large files go up in parts,
straight to the Blob store where the Instance allows it, and an interrupted
upload resumes from the parts already stored when you run the command again.
A part that fails for a reason that may pass, such as a dropped connection
or a 503 from a proxy, is sent again up to 6 times with a growing wait, and
part URLs that expired are renewed. When finishing an upload fails for a
reason that may pass, the Instance answers 503 with Retry-After, a proxy
cuts the request off, or no answer comes within 5 minutes (40 seconds per
GiB for a file larger than 7.5 GiB), and the command waits and tries again,
up to 10 times.
A file that still fails does not stop the others: the command uploads the
rest, names the files that failed and makes no Commit, so running it again
sends only those files.
Files the Instance already has anywhere are not sent again.

With --branch, a branch that does not exist yet is created from the default
branch before the upload starts.

The .git folder and huggingface_hub's .cache/huggingface folder are skipped.

Usage:

hangar push <dir> <repo> [flags]

Examples:

hangar push ./my-finetune acme/my-finetune --create --private
hangar push ./data datasets/acme/reviews --message "Add the March export"
hangar push ./out acme/model --branch experiment --include '*.safetensors'

Flags:

Flag Description Default
--branch branch to commit to, created from the default branch if it does not exist (default: the default branch)
--create create the Repo if it does not exist
--create-pr open a pull request instead of committing to the branch
--description longer Commit description
--exclude skip files matching this pattern (repeatable)
--include only upload files matching this pattern (repeatable)
--json print JSON instead of a table
-m, --message Commit message Upload with hangar push
--private with --create, make the new Repo private
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--type Repo type for IDs without a prefix: model or dataset
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

Search the Arsenal, or an Upstream with --upstream.

Searches the Repos you can see in the Arsenal. With --upstream, searches an
Upstream instead (Discover) and marks each result as in the Arsenal, partly in
the Arsenal, or not.

Filters for the Arsenal are key=value pairs: format, task, library, quant,
licence, ns, params_min, params_max, context_min, size_max, mirror, modality,
language and size_category. Filters for an Upstream are its tags, such as
gguf, mlx or text-generation.

Usage:

hangar search [query] [flags]

Examples:

hangar search llama --filter format=gguf --filter quant=Q4_K_M
hangar search --type dataset --filter task=text-classification
hangar search qwen --upstream --filter gguf --sort downloads

Flags:

Flag Description Default
--filter filter results (repeatable); see above
--json print JSON instead of a table
--limit maximum number of results, up to 500 50
--sort sort order: for the Arsenal updated, name, size, parameters, downloads or likes; for an Upstream trending, downloads, likes or lastModified
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--type Repo type: model or dataset model
--upstream search this Upstream instead of the Arsenal (default huggingface)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar server

Run the Instance: web UI, APIs and Jobs, as set by server.role.

Usage:

hangar server [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json write logs as JSON, the default (shortcut for --set telemetry.log_format=json)
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)

hangar version

Print the version.

Usage:

hangar version [flags]

Flags:

Flag Description Default
--json print JSON instead of text

hangar whoami

Show the signed-in user.

Usage:

hangar whoami

Flags:

Flag Description Default
--json print JSON instead of a table
--token Token to use instead of the saved login (or HANGAR_CLI_TOKEN)
--url Instance URL (default: from hangar login, or HANGAR_CLI_URL)

hangar worker

Run a worker that only runs Jobs, with health and metrics endpoints.

Usage:

hangar worker [flags]

Flags:

Flag Description Default
-c, --config YAML configuration file (or set HANGAR_CONFIG)
--json write logs as JSON, the default (shortcut for --set telemetry.log_format=json)
--listen shortcut for --set server.listen=...
--public-url shortcut for --set server.public_url=...
--role shortcut for --set server.role=...
--set set a configuration key, such as --set storage.backend=s3 (repeatable)