Skip to content

Commit 9580780

Browse files
davanstrienclaude
andauthored
Docs: document hf spaces ssh in the Spaces Dev Mode guide (#2534)
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 <subdomain>@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) <noreply@anthropic.com>
1 parent 3145653 commit 9580780

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

docs/hub/spaces-dev-mode.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ from huggingface_hub import HfApi
5555
print(HfApi().space_info("namespace/repo").subdomain)
5656
```
5757

58+
The Hugging Face CLI can resolve the subdomain and open the session for you:
59+
60+
```shell
61+
# SSH into the Space's Dev Mode container
62+
hf spaces ssh username/my-space
63+
64+
# Print the SSH command instead of running it
65+
hf spaces ssh username/my-space --dry-run
66+
67+
# Use a specific identity file
68+
hf spaces ssh username/my-space -i ~/.ssh/id_ed25519
69+
```
70+
71+
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.
72+
5873
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.
5974
Check out the [Git over SSH](./security-git-ssh#add-a-ssh-key-to-your-account) documentation for more detailed instructions.
6075

0 commit comments

Comments
 (0)