2

I am new to git and github (I used Subversion before). I can not find a solution how to export master branch only from my private repository to my production server.

I need to prepare an automated solution (called via fabric). I found that git has the archive command but this doesn't work with github (I set up SSH keys):

someuser@ews1:~/sandbox$ git archive --format=tar --remote=git@github.com:someuser/somerepository.git master
Invalid command: 'git-upload-archive 'someuser/somerepository.git''
  You appear to be using ssh to clone a git:// URL.
  Make sure your core.gitProxy config option and the
  GIT_PROXY_COMMAND environment variable are NOT set.
fatal: The remote end hung up unexpectedly

So I will need an another way how to do this. I don't want any meta files from git in the export. When I do clone, I will have all these files in .git directory (what I don't want) and this downloads more data than I really need.

Is there a way how to do this over ssh? Or I have to download the zip over HTTPS only?

Bruce
  • 1,380
  • 2
  • 13
  • 17

2 Answers2

2

I'm not sure I fully understood your question.

I use this command to pull the current master version to my server:

curl -sL --user "user:pass" https://github.com/<organisation>/<repository>/archive/master.zip > master.zip

Does this help?

SimonW
  • 6,175
  • 4
  • 33
  • 39
  • Yes, something like that. I thought that I can get it over SSH too but probably not. I found these steps (https://help.github.com/articles/downloading-files-from-the-command-line) with token instead of the password but this doesn't work. – Bruce Nov 14 '12 at 12:39
  • I tried that tutorial too some time ago and it didn't work for me either... :) If the answer helped you're welcome to V it ;) – SimonW Nov 18 '12 at 13:13
  • Did any one found solution for git archive using ssh? I am also facing the same issue. – Nandha Mar 06 '13 at 11:40
0

As I explained in SO answer on downloading GitHub archives from a private repo, after creating a GitHub access token, you can use wget or curl to obtain the desired <version> of your repo (e.g. master, HEAD, commit SHA-1, ...).

Solution with wget:

wget --output-document=<version>.tar.gz \
    https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN>

Solution with curl:

curl -L https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN> \
    > <version>.tar.gz
Community
  • 1
  • 1
tjanez
  • 2,175
  • 1
  • 21
  • 14