How do you pull a community GGUF from Hugging Face straight into Ollama, which quant arrives by default, and how does a private repo authenticate?
answer
- a different host in the name
- hf.co/{username}/{repository}
- a default quant if present
- the quant as the tag
- Ollama's own SSH public key
basics
~10 sRun ollama pull hf.co/{username}/{repository}. Ollama takes Q4_K_M when the repo has it, else a reasonable quant present; add :{quantization} to choose. Private repos need Ollama's id_ed25519.pub added as a Hugging Face SSH key.
solid answer
~40 sA GGUF repo on the Hub is addressed like any other model, with `hf.co` (or `huggingface.co`) as the host: `ollama pull hf.co/{username}/{repository}`, no Modelfile needed. Without a tag Ollama takes the `Q4_K_M` file if the repo has one and otherwise picks one reasonable quant that is present; a tag selects another, case-insensitively (`:IQ3_M`, `:q8_0`) or by full file name. The chat template is chosen automatically from the GGUF's `tokenizer.chat_template` metadata, and the repo can override it with a Go-template `template` file, plus `system` and `params` files. For a private repo, the documented route is Ollama's own key pair: add the contents of `id_ed25519.pub` as an SSH key on your Hugging Face account. The key must be the server's, which for the Linux service lives at `/usr/share/ollama/.ollama/id_ed25519.pub`, not in your home directory.
go deeper
Recall the hf.co/{username}/{repository} form, that no Modelfile is needed, and that a specific quant is chosen by adding it as the tag.
Explain the default quant rule, case-insensitive quant tags and full file names as tags, and that the template comes from the GGUF's embedded chat template.
Get private pulls working on a headless Linux box by registering the service user's key, and pin the quant in the name so every machine resolves the same file.
Decide whether a team may pull community GGUFs straight from the Hub or only from a vetted, re-published copy, weighing speed of trying models against control over what runs.
## The Hub as just another host Ollama's model names carry a host part, normally defaulted to `registry.ollama.ai`. Writing `hf.co` there points the pull at the Hugging Face Hub instead, and `huggingface.co` works as well: ```bash ollama pull hf.co/{username}/{repository} ollama run hf.co/{username}/{repository}:{quantization} ``` The repository has to contain **GGUF** files: the single-file format llama.cpp-based runtimes load. Many community accounts publish GGUF builds of popular models, and any of them can run with one command and **no Modelfile**. The pulled model lands in the same store as library models, under its `hf.co/...` name, and from then on `ollama ls`, `ollama rm` and `ollama cp` treat it like any other model. ## Which file you get A GGUF repo usually holds many files of the same model at different quantization levels. The tag decides which one arrives: | Tag you give | What Ollama pulls | |---|---| | none | the `Q4_K_M` file if the repo has one; otherwise one reasonable quant that is present | | `:IQ3_M`, `:Q8_0` | the file with that quant type | | `:iq3_m` | the same; the quant name is case-insensitive | | `:<file name>.gguf` | exactly that file, named in full | Two practical points follow: - **Pin the quant in the name** when more than one machine must match. "Whatever the default picked" depends on what the repo contains, and a repo can gain or lose files. - The tag is a **selector**, not an explanation. What `Q4_K_M` or `IQ3_M` trades in quality and memory belongs to the GGUF quantization material; here you only need to name the one you chose. ## The chat template and defaults A chat model needs a prompt template. For an `hf.co` pull nobody writes one: the format is worked out from the `tokenizer.chat_template` metadata embedded in the GGUF, which the Hub's documentation describes as selecting from a list of commonly used templates. When the file has no embedded template, or you want a different one, the repo itself can carry overrides: - a file named `template`, written as a **Go template** (not Jinja); - a file named `system` holding a system prompt; - a file named `params` in JSON with sampling parameters. If you cannot change the repo, customising a local model built over the pulled one is the Modelfile material's subject. ## Private repositories: Ollama's key, not your token Ollama generates its own **ed25519 key pair** and uses it to talk to registries. For private GGUFs on your personal account or an organisation you belong to, the documented steps are: 1. Copy Ollama's public key, `id_ed25519.pub`. 2. On Hugging Face, open your account's SSH key settings and add it as a new SSH key. 3. Run `ollama run hf.co/{username}/{repository}` as usual. The trap is **which** key. The pull is performed by the Ollama server, so it is the server's key that must be registered: - macOS app: `~/.ollama/id_ed25519.pub` - Linux systemd service: `/usr/share/ollama/.ollama/id_ed25519.pub`, the home of the `ollama` service user - Windows: `C:\Users\<username>\.ollama\id_ed25519.pub` On a Linux box, pasting the key from your own home directory registers a key the service never uses, and the pull keeps failing. Registering a key with Hugging Face is also separate from `ollama signin`, which connects the same key to ollama.com and grants nothing on the Hub. ## What stays outside this command Hub access tokens, gated licence acceptance, revisions and the Hub's own download cache belong to the Hub material; they are not how Ollama authenticates. Whether a community GGUF can be trusted is a supply-chain question with its own material. What belongs here is the mechanics: the host in the name, the quant as the tag, the template picked from the file, and the server's key for private repos. ## Checking and updating what arrived - `ollama ls` lists the model under its `hf.co/...` name with an `ID`, the start of its manifest digest; compare it across machines that must match. - A Hub repo can replace a file under the same quant name, so a later pull of the same name can bring different bytes. Re-pull deliberately, not on every boot. - Behind a corporate proxy, pulls go out over HTTPS: set `HTTPS_PROXY` for the server, install the proxy's certificate as a system certificate, and avoid `HTTP_PROXY`, which Ollama does not use for pulls and which can break client connections to the server. - `ollama rm` removes an `hf.co` model exactly like a library model: the manifest, then only the blobs nothing else references.
- On a Linux server running the Ollama service, a private `hf.co` pull keeps failing although you added `~/.ollama/id_ed25519.pub` to Hugging Face. Why?The pull is made by the server, which runs as the `ollama` user with its own key at `/usr/share/ollama/.ollama/id_ed25519.pub`. The key in your home directory belongs to your user and is not what the service signs with. Add the service's public key as an SSH key on the Hugging Face account that can read the repo, then pull again.
- The repo owner fixes a broken file under the same quant name. How do you get the fix into Ollama, and what happens to the old download?Pull the same `hf.co/{username}/{repository}:{quantization}` name again. The pull fetches the current manifest, downloads only blobs not already in the store and verifies them by sha256, then replaces the manifest. The old weights blob, no longer referenced by any manifest, is removed after the pull unless `OLLAMA_NOPRUNE` is set.
- Ollama can pull only from its own library, so a Hub GGUF needs a Modelfile first.
- Without a tag, an hf.co pull downloads every quant in the repo.
- Private hf.co repos authenticate with ollama signin.
- The template file in a GGUF repo must be written in Jinja.
- Any public key in your home directory works for the Linux service's private pulls.