# \[Spaces, Dev mode\] VS Code web - cannot push commits

**URL:** <https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957>\
**Category:** Spaces\
**Created:** [November 5, 2025, 9:59am UTC](https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957 "2025-11-05T09:59:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ark-kun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ark-kun/32/54494_2.png) [@Ark-kun](https://discuss.huggingface.co/u/Ark-kun)\
**Post date:** [November 5, 2025, 9:59am UTC](https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957/1 "2025-11-05T09:59:10Z")

</div>

Cloned the official example space: [Example: Python - a Hugging Face Space by dev-mode-explorers](https://huggingface.co/spaces/dev-mode-explorers/dev-mode-python)  
Enabled Dev Mode.  
Pressed “Connect using VS Code in your Browser.“  
Made changes. Committed changes.  
Documentation tells me to do “git push“. [Spaces Dev Mode: Seamless development in Spaces](https://huggingface.co/docs/hub/spaces-dev-mode#persisting-changes)  
Running `git push` in terminal causes VSCode to ask for username, then password, then HF refuses to accept the push:

```auto
user@r-ark-kun-dev-mode-python-9gftiur4-152e0-6q8wp:/app$ git push
remote: Password authentication in git is no longer supported. You must use a user access token or an SSH key instead. See https://huggingface.co/blog/password-git-deprecation
fatal: Authentication failed for 'https://huggingface.co/spaces/Ark-kun/dev-mode-python/'

```

Expectation: Pushing changes works automatically from inside the HF Space.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f726d48e92af11e3e88f68f533a510eaab48d5c.png)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 10, 2025, 1:12pm UTC](https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957/2 "2025-11-10T13:12:58Z")

</div>

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](https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957 "[Spaces, Dev mode] VS Code web - cannot push commits"))

# 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 `git` and `git-lfs` as required. ([Hugging Face](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))
- 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](https://huggingface.co/blog/password-git-deprecation "Deprecation of Git Authentication using password"))

# Root causes

1. **No Git credentials in the container.** HTTPS push falls back to username/password and is rejected. ([Hugging Face Forums](https://discuss.huggingface.co/t/spaces-dev-mode-vs-code-web-cannot-push-commits/169957 "[Spaces, Dev mode] VS Code web - cannot push commits"))
2. **Missing or wrong token scope.** A read-only token yields 403 on push. Use a **write** token. ([Hugging Face](https://huggingface.co/docs/huggingface_hub/en/quick-start "Quickstart"))
3. **SSH not set up in the container.** `git@hf.co` fails or prints “Hi anonymous.” Public key not added or wrong key selected. Sometimes stale `known_hosts` causes mis-match. ([Hugging Face Forums](https://discuss.huggingface.co/t/added-my-ssh-key-cannot-push-to-spaces-repo/131631 "Added my SSH key, cannot push to Spaces repo"))
4. **`git-lfs` absent or not initialized.** Large files push fails or is refused. Dev-Mode requires `git-lfs`. ([Hugging Face](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))
5. **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](https://discuss.huggingface.co/t/unable-to-push-to-spaces-using-vs-code/73298 "Unable to push to Spaces using VS Code - Beginners"))
6. **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](https://github.com/microsoft/vscode-remote-release/issues/11296 "Cannot connect to HuggingFace Spaces dev mode."))

# Fast fixes (choose HTTPS or SSH)

## Option A — HTTPS with a Hub token

Run **inside Dev-Mode terminal** :

```bash
# 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](https://huggingface.co/docs/huggingface_hub/en/quick-start "Quickstart"))

## Option B — SSH key in the container

Run **inside Dev-Mode terminal** :

```bash
# 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](https://discuss.huggingface.co/t/added-my-ssh-key-cannot-push-to-spaces-repo/131631 "Added my SSH key, cannot push to Spaces repo"))

# Make the container capable of pushing

```bash
# 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:

```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:

```bash
# 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](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))

# Diagnostics checklist

- `git remote -v` shows `https://huggingface.co/spaces/<user>/<space>.git` or `git@hf.co:spaces/<user>/<space>.git`. Fix if not. ([Hugging Face](https://huggingface.co/docs/hub/en/repositories-getting-started "Getting Started with Repositories"))
- HTTPS: `huggingface-cli whoami` returns your user. Token has **write** role. ([Hugging Face](https://huggingface.co/docs/huggingface_hub/en/quick-start "Quickstart"))
- SSH: `ssh -T git@hf.co` greets you by username. If not, re-add key or clean `~/.ssh/known_hosts`. ([Hugging Face Forums](https://discuss.huggingface.co/t/added-my-ssh-key-cannot-push-to-spaces-repo/131631 "Added my SSH key, cannot push to Spaces repo"))
- LFS: `git lfs env` and `git lfs ls-files` both work. Re-track binaries and re-commit if needed. ([Hugging Face](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))

# Similar cases you can map to

- Beginners thread: “Error with authentication: git push.” Password deprecated. Use token or SSH. ([Hugging Face Forums](https://discuss.huggingface.co/t/error-with-authentication-git-push/57012 "Error with authentication : git push - Beginners"))
- “Added my SSH key, cannot push.” “Hi anonymous” symptom and fix. ([Hugging Face Forums](https://discuss.huggingface.co/t/added-my-ssh-key-cannot-push-to-spaces-repo/131631 "Added my SSH key, cannot push to Spaces repo"))
- Dev-Mode not working with VS Code reports. Confirms environment/auth pitfalls around Remote access. ([Hugging Face Forums](https://discuss.huggingface.co/t/dev-mode-doesnt-work-with-vs-code/101427 "Dev Mode doesn't work with vs code - Spaces"))

# Keep it working

- Store creds once: `huggingface-cli login --add-to-git-credential` in the container. Then `git push` is seamless. ([Hugging Face](https://huggingface.co/docs/huggingface_hub/en/guides/cli "Command Line Interface (CLI)"))
- Prefer SSH in shared or automated setups. Token rotation then isn’t needed on every container rebuild. ([Hugging Face](https://huggingface.co/docs/hub/en/security-git-ssh "Git over SSH"))
- Track large files with LFS from day one to avoid rewrite headaches later. ([Hugging Face](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))

# Short, curated references

**Set up and push**

- Dev-Mode guide with required packages and flow. ([Hugging Face](https://huggingface.co/docs/hub/en/spaces-dev-mode "Spaces Dev Mode: Seamless development in Spaces"))
- Quickstart for tokens and write scope. ([Hugging Face](https://huggingface.co/docs/huggingface_hub/en/quick-start "Quickstart"))
- Git over SSH on HF. ([Hugging Face](https://huggingface.co/docs/hub/en/security-git-ssh "Git over SSH"))

**Auth pitfalls**

- Password deprecation announcement. ([Hugging Face](https://huggingface.co/blog/password-git-deprecation "Deprecation of Git Authentication using password"))
- Forum threads on Git auth failures and SSH “anonymous”. ([Hugging Face Forums](https://discuss.huggingface.co/t/error-with-authentication-git-push/57012 "Error with authentication : git push - Beginners"))

**Dev-Mode ecosystem**

- VS Code Remote issue tracking recent connection quirks. ([GitHub](https://github.com/microsoft/vscode-remote-release/issues/11296 "Cannot connect to HuggingFace Spaces dev mode."))

Use Option A or B, verify tools, then push again from the Dev-Mode terminal.
