Added my SSH key, cannot push to Spaces repo

Hello, this is my first time using HuggingFace (I’ve been using GitHub for a long time), and I’m super excited to push code repos with live examples!

I added my SSH key in settings, but it will not let me push to my new Spaces repo.

Here’s my new account: trusktr (Joe Pea)

I can verify that SSH works, like so:

$ ssh git@hf.co
PTY allocation request failed on channel 0
Hi anonymous, welcome to Hugging Face.
Connection to hf.co closed.

(It says “anonymous”, does that indicate an problem inside HF?)

I created my first Space here:

When I try to push to this repo, I get this:

$ git remote -v
hf      git@hf.co:spaces/lume-creative/lume (fetch)
hf      git@hf.co:spaces/lume-creative/lume (push)

$ git push hf develop
remote: 
remote: ========================================================================
remote: 
remote: ERROR: This action requires authentication.
Make sure your SSH public key is linked with your profile on huggingface.co.
See https://huggingface.co/settings/keys.

remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

It seems like there’s a bug in HF, because the ssh test works (but tells me I am anonymous), so the key is accepted, but I am not recognized as the owner of my SSH key.

I’ve logged in with huggingface-cli but no luck. Here’s huggingface-cli env:

$ huggingface-cli env
/Users/trusktr/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(

Copy-and-paste the text below in your GitHub issue.

- huggingface_hub version: 0.26.5
- Platform: macOS-15.0.1-arm64-arm-64bit
- Python version: 3.9.6
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: /Users/trusktr/.cache/huggingface/token
- Has saved token ?: True
- Who am I ?: trusktr
- Configured git credential helpers: osxkeychain
- FastAI: N/A
- Tensorflow: N/A
- Torch: N/A
- Jinja2: N/A
- Graphviz: N/A
- keras: N/A
- Pydot: N/A
- Pillow: N/A
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: N/A
- pydantic: N/A
- aiohttp: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /Users/trusktr/.cache/huggingface/hub
- HF_ASSETS_CACHE: /Users/trusktr/.cache/huggingface/assets
- HF_TOKEN_PATH: /Users/trusktr/.cache/huggingface/token
- HF_STORED_TOKENS_PATH: /Users/trusktr/.cache/huggingface/stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10

After logging in with huggingface-cli, I get the same error as above when I git push. But I think that makes sense, as git is simply using SSH.

2 Likes

Looks like someone else has the exact same issue here, with no answer:

1 Like

Similar issue:

I tried erasing macOS ssh credential as described here:

But no luck.

1 Like

@not-lain ssh issue.

I managed to get git to connect by using the HTTPS remote URL format with user:token.

[remote "hf"]
	url = https://trusktr:<TOKEN>@huggingface.co/spaces/lume-creative/lume
	fetch = +refs/heads/*:refs/remotes/hf/*

However, now when I try to push, it fails:

❯ git push --recurse-submodules=no hf develop
Enumerating objects: 18207, done.
Counting objects: 100% (18207/18207), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5958/5958), done.
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (18207/18207), 72.05 MiB | 154.67 MiB/s, done.
Total 18207 (delta 13630), reused 16295 (delta 11969), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

The errors:

error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly

Have I goofed something up with LFS? Or is it something else like the git submodules which I have not yet pushed to HF?

EDIT: running this,

git config --global http.postBuffer 157286400

fixed the previous error by increasing memory size (or something). Looks like its an error related to the HTTP connection, which I haven’t encountered before as I always use SSH.

Now I’m receiving new errors like

... omitted ...
remote: Resolving deltas: 100% (13632/13632), done.
remote: -------------------------------------------------------------------------
remote: Your push was rejected because it contains files larger than 10 MiB.
remote: Please use https://git-lfs.github.com/ to store large files.
remote: See also: https://hf.co/docs/hub/repositories-getting-started#terminal
remote: 
remote: Offending files:
remote:   - docs/examples/velodyne-lidar-scan/shelby-scene.ply (ref: refs/heads/main)
remote:   - docs/examples/velodyne-lidar-scan/shelby-scene.ply (ref: refs/tags/v0.3.0-alpha.10)
remote:   - docs/examples/velodyne-lidar-scan/shelby-scene.ply (ref: refs/tags/v0.3.0-alpha.11)
... omitted ...

so now I’ll try LFS.

EDIT: after installing Git LFS, my git pushes still get rejected. I’ll open a separate thread for that:

1 Like