从私有github存储库部署

时间:2012-11-14 11:30:06

标签: deployment github

我是git和github的新手(之前我使用过Subversion)。我找不到如何将master分支从我的私有存储库导出到生产服务器的解决方案。

我需要准备一个自动化解决方案(通过面料调用)。我发现git有archive命令,但这不适用于github(我设置了SSH密钥):

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

所以我需要另一种方法来做到这一点。我不想在导出中使用git中的任何元文件。当我做克隆时,我将把所有这些文件放在.git目录中(我不想要的),这会下载比我真正需要的更多的数据。

有没有办法在ssh上做到这一点?或者我只能通过HTTPS下载zip?

2 个答案:

答案 0 :(得分:2)

我不确定我完全理解你的问题。

我使用此命令将当前主版本拉到我的服务器:

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

这有帮助吗?

答案 1 :(得分:0)

正如我在SO answer on downloading GitHub archives from a private repo中所解释的,在创建GitHub access token后,您可以使用wgetcurl来获取所需的<version>回购广告(例如masterHEAD,提交SHA-1,...)。

wget的解决方案:

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

curl的解决方案:

curl -L https://api.github.com/repos/<owner>/<repo>/tarball/<version>?access_token=<OAUTH-TOKEN> \
    > <version>.tar.gz
相关问题