I haven’t used Dev mode from VSCode, so I’m not sure if the following applies, but I’ve seen similar cases.
You’re hitting Git auth and environment gaps inside Spaces Dev-Mode. VS Code Web runs inside the Space container, which has no Git credentials by default and may miss git-lfs. Hugging Face also removed password auth for Git in 2023, so username/password prompts always fail. Use a Hub token over HTTPS or SSH keys, and ensure git and git-lfs exist in the container. The original thread shows this exact pattern. (Hugging Face Forums)
Background
- Dev-Mode starts a VS Code server and shell in the Space container, not your local machine. That context needs its own credentials and tools. The official Dev-Mode guide lists
gitandgit-lfsas required. (Hugging Face) - Hugging Face disabled Git password auth on Oct 1, 2023. Only tokens or SSH are valid. Many users see the same prompt loop. (Hugging Face)
Root causes
- No Git credentials in the container. HTTPS push falls back to username/password and is rejected. (Hugging Face Forums)
- Missing or wrong token scope. A read-only token yields 403 on push. Use a write token. (Hugging Face)
- SSH not set up in the container.
git@hf.cofails or prints “Hi anonymous.” Public key not added or wrong key selected. Sometimes staleknown_hostscauses mis-match. (Hugging Face Forums) git-lfsabsent or not initialized. Large files push fails or is refused. Dev-Mode requiresgit-lfs. (Hugging Face)- Wrong remote or permissions. Pushing to the wrong repo URL or to a Space you cannot write. Multiple users report similar mis-routes. (Hugging Face Forums)
- Connection quirks with VS Code Remote. Recent reports show VS Code connection oddities around Dev-Mode. Auth must still be valid inside the container even if VS Code connects. (GitHub)
Fast fixes (choose HTTPS or SSH)
Option A — HTTPS with a Hub token
Run inside Dev-Mode terminal:
# Install CLI if missing; logs into Hub and stores token for Git
# Docs: https://huggingface.co/docs/huggingface_hub/en/guides/cli
pip install -U huggingface_hub # https://pypi.org/project/huggingface_hub/
huggingface-cli login --add-to-git-credential # https://huggingface.co/docs/huggingface_hub/en/quick-start
# Verify remote is the Space repo
git remote -v # expect https://huggingface.co/spaces/<user>/<space>.git
# Commit and push
git add -A
git commit -m "Dev-Mode changes"
git push
Notes: Use a write-scoped token. Passwords do not work. (Hugging Face)
Option B — SSH key in the container
Run inside Dev-Mode terminal:
# Generate key and add public key to HF Settings → SSH keys
# Docs: https://huggingface.co/docs/hub/en/security-git-ssh
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub # paste into HF account SSH keys
# Test and then switch remote to SSH
ssh -T git@hf.co # should greet you by username
git remote set-url origin git@hf.co:spaces/<user>/<space>.git
git push
If ssh -T git@hf.co says “Hi anonymous,” you are not using the key HF knows. Ensure the correct key is loaded, and clear any stale known_hosts entry for hf.co before retrying. (Hugging Face Forums)
Make the container capable of pushing
# In Dev-Mode terminal
git --version || sudo apt-get update && sudo apt-get install -y git
git lfs version || sudo apt-get install -y git-lfs
git lfs install
For Docker Spaces, bake these into your Dockerfile:
# Docs: https://huggingface.co/docs/hub/en/spaces-dev-mode
RUN apt-get update && apt-get install -y git git-lfs bash curl wget procps
Track common large files before first push:
# Docs: https://git-lfs.com
git lfs track "*.pt" "*.safetensors" "*.bin" "*.onnx" "*.jpg" "*.png"
git add .gitattributes
Dev-Mode explicitly requires git and git-lfs. Without them, commits stay local and pushes fail. (Hugging Face)
Diagnostics checklist
git remote -vshowshttps://huggingface.co/spaces/<user>/<space>.gitorgit@hf.co:spaces/<user>/<space>.git. Fix if not. (Hugging Face)- HTTPS:
huggingface-cli whoamireturns your user. Token has write role. (Hugging Face) - SSH:
ssh -T git@hf.cogreets you by username. If not, re-add key or clean~/.ssh/known_hosts. (Hugging Face Forums) - LFS:
git lfs envandgit lfs ls-filesboth work. Re-track binaries and re-commit if needed. (Hugging Face)
Similar cases you can map to
- Beginners thread: “Error with authentication: git push.” Password deprecated. Use token or SSH. (Hugging Face Forums)
- “Added my SSH key, cannot push.” “Hi anonymous” symptom and fix. (Hugging Face Forums)
- Dev-Mode not working with VS Code reports. Confirms environment/auth pitfalls around Remote access. (Hugging Face Forums)
Keep it working
- Store creds once:
huggingface-cli login --add-to-git-credentialin the container. Thengit pushis seamless. (Hugging Face) - Prefer SSH in shared or automated setups. Token rotation then isn’t needed on every container rebuild. (Hugging Face)
- Track large files with LFS from day one to avoid rewrite headaches later. (Hugging Face)
Short, curated references
Set up and push
- Dev-Mode guide with required packages and flow. (Hugging Face)
- Quickstart for tokens and write scope. (Hugging Face)
- Git over SSH on HF. (Hugging Face)
Auth pitfalls
- Password deprecation announcement. (Hugging Face)
- Forum threads on Git auth failures and SSH “anonymous”. (Hugging Face Forums)
Dev-Mode ecosystem
- VS Code Remote issue tracking recent connection quirks. (GitHub)
Use Option A or B, verify tools, then push again from the Dev-Mode terminal.