Huggingface git server returns null as Content-Type on push

Hi, we are pushing our datasets programmatically using jGit, a git client for java.

On a push we receive the error expected Content-Type application/x-git-receive-pack-result; received Content-Type null. So it seems that the git server returns a message the client does not expect.

Does anybody have experience pushing data to the huggingface git server via java/kotlin? Or does anybody know about the configuration on server side?

1 Like

Java users at HF seem to be rare and not much information is available…
In my country, Java is the most major programming language for large system development.

@not-lain Do you know anything about the compatibility of jgit and HF?

1 Like

hi @padmalcom

I just tried to push something with “git”. According to output it seems git client sends “accept: application/x-git-receive-pack-result”. And in your case jGit doesn’t send it and HF git server complains about it. Am I wrong?

15:20:26.424120 http.c:623 => Send header: accept: application/x-git-receive-pack-result

Full log:

$ GIT_CURL_VERBOSE=1 git push https://mahmutc:my_token@huggingface.co/datasets/mahmutc/test
15:20:25.764496 http.c:664              == Info:   Trying 3.160.150.119:443...
15:20:25.825011 http.c:664              == Info: Connected to huggingface.co (3.160.150.119) port 443 (#0)
15:20:25.998157 http.c:664              == Info: found 438 certificates in /etc/ssl/certs
15:20:26.000818 http.c:664              == Info: GnuTLS ciphers: NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509:-VERS-SSL3.0
15:20:26.000867 http.c:664              == Info: ALPN, offering h2
15:20:26.000871 http.c:664              == Info: ALPN, offering http/1.1
15:20:26.068382 http.c:664              == Info: SSL connection using TLS1.3 / ECDHE_RSA_AES_128_GCM_SHA256
15:20:26.070993 http.c:664              == Info:   server certificate verification OK
15:20:26.071033 http.c:664              == Info:   server certificate status verification SKIPPED
15:20:26.071137 http.c:664              == Info:   common name: huggingface.co (matched)
15:20:26.071176 http.c:664              == Info:   server certificate expiration date OK
15:20:26.071215 http.c:664              == Info:   server certificate activation date OK
15:20:26.071227 http.c:664              == Info:   certificate public key: RSA
15:20:26.071235 http.c:664              == Info:   certificate version: #3
15:20:26.071246 http.c:664              == Info:   subject: CN=huggingface.co
15:20:26.071253 http.c:664              == Info:   start date: Mon, 13 May 2024 00:00:00 GMT
15:20:26.071284 http.c:664              == Info:   expire date: Wed, 11 Jun 2025 23:59:59 GMT
15:20:26.071330 http.c:664              == Info:   issuer: C=US,O=Amazon,CN=Amazon RSA 2048 M03
15:20:26.071346 http.c:664              == Info: ALPN, server accepted to use h2
15:20:26.071499 http.c:664              == Info: Using HTTP2, server supports multiplexing
15:20:26.071528 http.c:664              == Info: Connection state changed (HTTP/2 confirmed)
15:20:26.071537 http.c:664              == Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
15:20:26.071584 http.c:664              == Info: Using Stream ID: 1 (easy handle 0x556ffbfb9c30)
15:20:26.071627 http.c:611              => Send header, 0000000220 bytes (0x000000dc)
15:20:26.071635 http.c:623              => Send header: GET /datasets/mahmutc/test/info/refs?service=git-receive-pack HTTP/2
15:20:26.071639 http.c:623              => Send header: Host: huggingface.co
15:20:26.071664 http.c:623              => Send header: user-agent: git/2.34.1
15:20:26.071669 http.c:623              => Send header: accept: */*
15:20:26.071676 http.c:623              => Send header: accept-encoding: deflate, gzip, br, zstd
15:20:26.071683 http.c:623              => Send header: accept-language: C, *;q=0.9
15:20:26.071687 http.c:623              => Send header: pragma: no-cache
15:20:26.071690 http.c:623              => Send header:
15:20:26.127213 http.c:664              == Info: Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
15:20:26.227879 http.c:611              <= Recv header, 0000000013 bytes (0x0000000d)
15:20:26.227921 http.c:623              <= Recv header: HTTP/2 401
15:20:26.227931 http.c:611              <= Recv header, 0000000041 bytes (0x00000029)
15:20:26.227937 http.c:623              <= Recv header: content-type: text/plain; charset=utf-8
15:20:26.227942 http.c:611              <= Recv header, 0000000020 bytes (0x00000014)
15:20:26.227946 http.c:623              <= Recv header: content-length: 29
15:20:26.227951 http.c:611              <= Recv header, 0000000037 bytes (0x00000025)
15:20:26.227956 http.c:623              <= Recv header: date: Mon, 14 Oct 2024 13:20:26 GMT
15:20:26.227960 http.c:611              <= Recv header, 0000000032 bytes (0x00000020)
15:20:26.227964 http.c:623              <= Recv header: x-powered-by: huggingface-moon
15:20:26.227969 http.c:611              <= Recv header, 0000000041 bytes (0x00000029)
15:20:26.227972 http.c:623              <= Recv header: cross-origin-opener-policy: same-origin
15:20:26.227977 http.c:611              <= Recv header, 0000000050 bytes (0x00000032)
15:20:26.227981 http.c:623              <= Recv header: referrer-policy: strict-origin-when-cross-origin
15:20:26.227985 http.c:611              <= Recv header, 0000000056 bytes (0x00000038)
15:20:26.228064 http.c:623              <= Recv header: x-request-id: Root=1-670d1a9a-287757ea6ec2625e2161ae2b
15:20:26.228076 http.c:611              <= Recv header, 0000000053 bytes (0x00000035)
15:20:26.228082 http.c:623              <= Recv header: access-control-allow-origin: https://huggingface.co
15:20:26.228087 http.c:611              <= Recv header, 0000000014 bytes (0x0000000e)
15:20:26.228094 http.c:623              <= Recv header: vary: Origin
15:20:26.228154 http.c:611              <= Recv header, 0000000140 bytes (0x0000008c)
15:20:26.228167 http.c:623              <= Recv header: access-control-expose-headers: X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range
15:20:26.228177 http.c:611              <= Recv header, 0000000048 bytes (0x00000030)
15:20:26.228233 http.c:623              <= Recv header: x-error-message: Invalid username or password.
15:20:26.228253 http.c:611              <= Recv header, 0000000074 bytes (0x0000004a)
15:20:26.228262 http.c:623              <= Recv header: www-authenticate: Basic realm="Authentication required", charset="UTF-8"
15:20:26.228321 http.c:611              <= Recv header, 0000000042 bytes (0x0000002a)
15:20:26.228331 http.c:623              <= Recv header: etag: W/"1d-DMkJvg8tpLoaQbsiq9Mz7l2CJyI"
15:20:26.228338 http.c:611              <= Recv header, 0000000032 bytes (0x00000020)
15:20:26.228343 http.c:623              <= Recv header: x-cache: Error from cloudfront
15:20:26.228349 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.228409 http.c:623              <= Recv header: via: 1.1 6f4aa26c09fb9bb4d152519f44256a4c.cloudfront.net (CloudFront)
15:20:26.228461 http.c:611              <= Recv header, 0000000024 bytes (0x00000018)
15:20:26.228508 http.c:623              <= Recv header: x-amz-cf-pop: FRA60-P7
15:20:26.228518 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.228523 http.c:623              <= Recv header: x-amz-cf-id: xwCEKExupflEO-98bOEiagh5y2Cmf_GqKQ2LvsdjYCyzBW09ioS1MA==
15:20:26.228531 http.c:611              <= Recv header, 0000000002 bytes (0x00000002)
15:20:26.228535 http.c:623              <= Recv header:
15:20:26.228540 http.c:664              == Info: Ignoring the response-body
15:20:26.228627 http.c:664              == Info: Connection #0 to host huggingface.co left intact
15:20:26.228667 http.c:664              == Info: Issue another request to this URL: 'https://mahmutc:my_token@huggingface.co/datasets/mahmutc/test/info/refs?service=git-receive-pack'
15:20:26.228710 http.c:664              == Info: Found bundle for host huggingface.co: 0x556ffbfc0470 [can multiplex]
15:20:26.228773 http.c:664              == Info: Re-using existing connection! (#0) with host huggingface.co
15:20:26.228787 http.c:664              == Info: Connected to huggingface.co (3.160.150.119) port 443 (#0)
15:20:26.228814 http.c:664              == Info: Server auth using Basic with user 'mahmutc'
15:20:26.228885 http.c:664              == Info: Using Stream ID: 3 (easy handle 0x556ffbfb9c30)
15:20:26.228980 http.c:611              => Send header, 0000000303 bytes (0x0000012f)
15:20:26.229062 http.c:623              => Send header: GET /datasets/mahmutc/test/info/refs?service=git-receive-pack HTTP/2
15:20:26.229073 http.c:623              => Send header: Host: huggingface.co
15:20:26.229079 http.c:623              => Send header: authorization: Basic <redacted>
15:20:26.229085 http.c:623              => Send header: user-agent: git/2.34.1
15:20:26.229091 http.c:623              => Send header: accept: */*
15:20:26.229097 http.c:623              => Send header: accept-encoding: deflate, gzip, br, zstd
15:20:26.229103 http.c:623              => Send header: accept-language: C, *;q=0.9
15:20:26.229109 http.c:623              => Send header: pragma: no-cache
15:20:26.229114 http.c:623              => Send header:
15:20:26.387056 http.c:611              <= Recv header, 0000000013 bytes (0x0000000d)
15:20:26.387203 http.c:623              <= Recv header: HTTP/2 200
15:20:26.387218 http.c:611              <= Recv header, 0000000060 bytes (0x0000003c)
15:20:26.387223 http.c:623              <= Recv header: content-type: application/x-git-receive-pack-advertisement
15:20:26.387229 http.c:611              <= Recv header, 0000000037 bytes (0x00000025)
15:20:26.387233 http.c:623              <= Recv header: date: Mon, 14 Oct 2024 13:20:26 GMT
15:20:26.387238 http.c:611              <= Recv header, 0000000032 bytes (0x00000020)
15:20:26.387241 http.c:623              <= Recv header: x-powered-by: huggingface-moon
15:20:26.387246 http.c:611              <= Recv header, 0000000041 bytes (0x00000029)
15:20:26.387249 http.c:623              <= Recv header: cross-origin-opener-policy: same-origin
15:20:26.387285 http.c:611              <= Recv header, 0000000050 bytes (0x00000032)
15:20:26.387289 http.c:623              <= Recv header: referrer-policy: strict-origin-when-cross-origin
15:20:26.387294 http.c:611              <= Recv header, 0000000056 bytes (0x00000038)
15:20:26.387297 http.c:623              <= Recv header: x-request-id: Root=1-670d1a9a-070cd6e010e66c630db1bbcf
15:20:26.387302 http.c:611              <= Recv header, 0000000053 bytes (0x00000035)
15:20:26.387305 http.c:623              <= Recv header: access-control-allow-origin: https://huggingface.co
15:20:26.387310 http.c:611              <= Recv header, 0000000014 bytes (0x0000000e)
15:20:26.387314 http.c:623              <= Recv header: vary: Origin
15:20:26.387318 http.c:611              <= Recv header, 0000000140 bytes (0x0000008c)
15:20:26.387323 http.c:623              <= Recv header: access-control-expose-headers: X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range
15:20:26.387329 http.c:611              <= Recv header, 0000000031 bytes (0x0000001f)
15:20:26.387333 http.c:623              <= Recv header: x-cache: Miss from cloudfront
15:20:26.387337 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.387341 http.c:623              <= Recv header: via: 1.1 6f4aa26c09fb9bb4d152519f44256a4c.cloudfront.net (CloudFront)
15:20:26.387346 http.c:611              <= Recv header, 0000000024 bytes (0x00000018)
15:20:26.387350 http.c:623              <= Recv header: x-amz-cf-pop: FRA60-P7
15:20:26.387354 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.387358 http.c:623              <= Recv header: x-amz-cf-id: feAo6SrPWyci8F0ZQmWLIGhRfOdhha2JGWA-3L1SgFr1KXcGqx7jjA==
15:20:26.387397 http.c:611              <= Recv header, 0000000002 bytes (0x00000002)
15:20:26.387402 http.c:623              <= Recv header:
15:20:26.387500 http.c:664              == Info: Connection #0 to host huggingface.co left intact
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 273 bytes | 273.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
15:20:26.423824 http.c:664              == Info: Found bundle for host huggingface.co: 0x556ffbfc0470 [can multiplex]
15:20:26.423875 http.c:664              == Info: Re-using existing connection! (#0) with host huggingface.co
15:20:26.423883 http.c:664              == Info: Connected to huggingface.co (3.160.150.119) port 443 (#0)
15:20:26.423899 http.c:664              == Info: Server auth using Basic with user 'mahmutc'
15:20:26.423922 http.c:664              == Info: Using Stream ID: 5 (easy handle 0x556ffbfb9c30)
15:20:26.423993 http.c:611              => Send header, 0000000348 bytes (0x0000015c)
15:20:26.424036 http.c:623              => Send header: POST /datasets/mahmutc/test/git-receive-pack HTTP/2
15:20:26.424100 http.c:623              => Send header: Host: huggingface.co
15:20:26.424104 http.c:623              => Send header: authorization: Basic <redacted>
15:20:26.424106 http.c:623              => Send header: user-agent: git/2.34.1
15:20:26.424115 http.c:623              => Send header: accept-encoding: deflate, gzip, br, zstd
15:20:26.424118 http.c:623              => Send header: content-type: application/x-git-receive-pack-request
15:20:26.424120 http.c:623              => Send header: accept: application/x-git-receive-pack-result
15:20:26.424123 http.c:623              => Send header: content-length: 446
15:20:26.424125 http.c:623              => Send header:
15:20:26.424149 http.c:664              == Info: We are completely uploaded and fine
15:20:26.725070 http.c:611              <= Recv header, 0000000013 bytes (0x0000000d)
15:20:26.725152 http.c:623              <= Recv header: HTTP/2 200
15:20:26.725163 http.c:611              <= Recv header, 0000000037 bytes (0x00000025)
15:20:26.725171 http.c:623              <= Recv header: date: Mon, 14 Oct 2024 13:20:26 GMT
15:20:26.725176 http.c:611              <= Recv header, 0000000032 bytes (0x00000020)
15:20:26.725180 http.c:623              <= Recv header: x-powered-by: huggingface-moon
15:20:26.725184 http.c:611              <= Recv header, 0000000041 bytes (0x00000029)
15:20:26.725188 http.c:623              <= Recv header: cross-origin-opener-policy: same-origin
15:20:26.725193 http.c:611              <= Recv header, 0000000050 bytes (0x00000032)
15:20:26.725199 http.c:623              <= Recv header: referrer-policy: strict-origin-when-cross-origin
15:20:26.725203 http.c:611              <= Recv header, 0000000056 bytes (0x00000038)
15:20:26.725210 http.c:623              <= Recv header: x-request-id: Root=1-670d1a9a-05170e337d7ba9a56e50f003
15:20:26.725214 http.c:611              <= Recv header, 0000000053 bytes (0x00000035)
15:20:26.725218 http.c:623              <= Recv header: access-control-allow-origin: https://huggingface.co
15:20:26.725222 http.c:611              <= Recv header, 0000000014 bytes (0x0000000e)
15:20:26.725226 http.c:623              <= Recv header: vary: Origin
15:20:26.725231 http.c:611              <= Recv header, 0000000140 bytes (0x0000008c)
15:20:26.725235 http.c:623              <= Recv header: access-control-expose-headers: X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range
15:20:26.725241 http.c:611              <= Recv header, 0000000031 bytes (0x0000001f)
15:20:26.725245 http.c:623              <= Recv header: x-cache: Miss from cloudfront
15:20:26.725249 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.725253 http.c:623              <= Recv header: via: 1.1 6f4aa26c09fb9bb4d152519f44256a4c.cloudfront.net (CloudFront)
15:20:26.725258 http.c:611              <= Recv header, 0000000024 bytes (0x00000018)
15:20:26.725262 http.c:623              <= Recv header: x-amz-cf-pop: FRA60-P7
15:20:26.725266 http.c:611              <= Recv header, 0000000071 bytes (0x00000047)
15:20:26.725269 http.c:623              <= Recv header: x-amz-cf-id: FfABiBZZ0k9QUM3xMeLNU7V_DWsgvZGAtlHLc9Q3tjG3VftMYVde9w==
15:20:26.725275 http.c:611              <= Recv header, 0000000002 bytes (0x00000002)
15:20:26.725279 http.c:623              <= Recv header:
15:20:26.832362 http.c:664              == Info: Connection #0 to host huggingface.co left intact
To https://huggingface.co/datasets/mahmutc/test
   892e331..b586459  main -> main
1 Like

Hi @mahmutc,
thanks for your reply. It seems that your client says “I accept a response of type x-git-receive-pack-result”. Unfortunately, the log does not show if your client receives a satisfying response from the hf git.

The jGit client says the same but the hf git does not send a response and the jGit client complains.

But git completed the push. What about you? Did you successfully push what you wanted?

It seems you can’t :frowning: I don’t know if you can change the source code and run your own jgit.

https://git-scm.com/docs/http-protocol
gives some more information about dumb/smart server/client.

Unfortunately, the push is not completed. When I use another client I can see that the commit is successful, but the push is not. So I see no changes in the repository.
Recompiling jgit is too much work, I think I’ll write a python git client.
Thanks again for your help.

1 Like