11

I can do git clone like so ...

 git clone https://github.com/stackforge/puppet-heat.git

... with no problems. But I want to exclude all the git meta stuff that comes with the cloning, so I figured I would use git archive but I get this error:

$ git archive --remote=https://github.com/stackforge/puppet-heat.git 
fatal: Operation not supported by protocol.

Anyone know why or what I am doing wrong?

offby1
  • 162
  • 7
Red Cricket
  • 2,183
  • 6
  • 25
  • 37
  • 1
    There's an open issue that github doesn't support `git archive`: [Support git-archive protocol](https://github.com/isaacs/github/issues/554) – AlikElzin-kilaka May 02 '18 at 11:34

4 Answers4

6

You can use github's svn support:

svn export https://github.com/user/project/trunk

More details here:

https://stackoverflow.com/questions/9609835/git-export-from-github-remote-repository

Sam Hasler
  • 159
  • 1
  • 4
4

I would simply run the git clone as you've described and then delete the .git directories that are dispersed throughout the cloned directory.

$  find puppet-heat/ -name '.git' -exec rm -fr {} +
slm
  • 363,520
  • 117
  • 767
  • 871
  • Thanks. I found the "Download Zip" link on their github and I just did a `wget https://github.com/stackforge/puppet-heat/archive/stable/havana.zip` and unzipped it. – Red Cricket Jun 11 '14 at 00:58
1

git archive is still the right way to go:

git clone https://github.com/stackforge/puppet-heat.git cd puppet-heat git archive

The reason your approach doesn't work is - obviously - that github doesn't (or didn't) support the remote archiving. It would mean, that the archive is actually created as a file on the github server which is then sent.

So just clone the repo and run git archive on your clone.

alex
  • 11
  • 1
1

FYI I hit the same error with bitbucket. I switched protocols from https to ssh and it worked.

e.g:

git archive [email protected]/stackforge/puppet-heat.git 

Of course you need to have the public/private keys setup for this to work.

I have heard that github doesn't support remoting, but for others with this problem the above fixed it for me at least.

As our repo is huge, cloning it is not really an option if we just want to do the equivalent of an svn export.

John Little
  • 111
  • 4