38

I'm trying to checkout part of remote git repository. As recommended here, with help of command

git archive --format=zip --remote=http://path_to_repository

But I'm getting error message:

fatal: Operation not supported by protocol.
Unexpected end of command stream

Git is not supporting this operation with http protocol? Thats a problem of hosting environment or git itself? Any directions would help, thanks.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Sly
  • 15,046
  • 12
  • 60
  • 89

2 Answers2

16

git archive can work with a server with git protocol support (i.e. git server, smart-http and ssh server).

In your case, either your git is too old, or the server is dumb http server (normal http server, without "smart" git support). You need to clone the repository and archive from there.

200_success
  • 7,286
  • 1
  • 43
  • 74
J-16 SDiZ
  • 26,473
  • 4
  • 65
  • 84
  • Smart HTTP is used by our git server... What else could it be? – Sly Jun 29 '12 at 11:37
  • 1
    according to protocol description smart http is excluded as well: https://github.com/git/git/blob/master/Documentation/technical/http-protocol.txt – max630 Aug 25 '17 at 19:29
10

you can't use git achieve with http! only git protocol. i.e.

git archive --format=zip --remote=git://path_to_repository
Jérémie B
  • 10,611
  • 1
  • 26
  • 43
user4931107
  • 109
  • 1
  • 2
  • 3
    Do you have any sources to back up this claim? – Phil Jan 10 '18 at 13:24
  • I seems not working with git protocol in all cases. For example, there is a repo https://github.com/tesseract-ocr/tessdata. I can clone it as git://github.com/tesseract-ocr/tessdata.git thus the URL is correct. However if I try "git archive --remote=git://github.com/tesseract-ocr/tessdata.git 4.0.0 eng.traineddata" it says "fatal: The remote end hung up unexpectedly". Do you have a clue what is the cause? – Alexander Samoylov Nov 20 '19 at 16:49
  • Found: https://stackoverflow.com/questions/30659758/git-archive-remote-end-hung-up. This does not work at all with GitHub. – Alexander Samoylov Nov 20 '19 at 16:56