From 4907909530865652f6558e124cb9b41249ef7733 Mon Sep 17 00:00:00 2001 From: Daniel van Strien Date: Thu, 4 Jun 2026 14:17:10 +0100 Subject: [PATCH] Docs: document `hf spaces ssh` in the Spaces Dev Mode guide Add a CLI shortcut to the Dev Mode SSH section: `hf spaces ssh` resolves the Space subdomain and opens the session for you, with `--dry-run` and `-i` examples plus an `--auto` note. Complements the existing manual `ssh @ssh.hf.space` instructions; the existing "register your SSH key" line covers the prerequisite for both paths. Added in huggingface_hub v1.17.0 (huggingface/huggingface_hub#4241). Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/hub/spaces-dev-mode.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/hub/spaces-dev-mode.md b/docs/hub/spaces-dev-mode.md index b3a65bb1b8..968c946396 100644 --- a/docs/hub/spaces-dev-mode.md +++ b/docs/hub/spaces-dev-mode.md @@ -55,6 +55,21 @@ from huggingface_hub import HfApi print(HfApi().space_info("namespace/repo").subdomain) ``` +The Hugging Face CLI can resolve the subdomain and open the session for you: + +```shell +# SSH into the Space's Dev Mode container +hf spaces ssh username/my-space + +# Print the SSH command instead of running it +hf spaces ssh username/my-space --dry-run + +# Use a specific identity file +hf spaces ssh username/my-space -i ~/.ssh/id_ed25519 +``` + +Pass `--auto` to enable Dev Mode without prompting if it isn't already running. See the [`hf spaces ssh` CLI reference](https://huggingface.co/docs/huggingface_hub/package_reference/cli#hf-spaces-ssh) for the full list of options. + You will need to add your machine's SSH public key to [your user account](https://huggingface.co/settings/keys) to be able to connect to the Space using SSH. Check out the [Git over SSH](./security-git-ssh#add-a-ssh-key-to-your-account) documentation for more detailed instructions.