2012-11-14 281 views
2

我是新来的git和github(我之前使用过Subversion)。我找不到解决方案,只能从我的私有存储库将主分支导出到我的生产服务器。从私人github存储库部署

我需要准备一个自动化解决方案(称为通过结构)。我发现,Git有存档的命令,但是这并不github上工作(我设置SSH密钥):

[email protected]:~/sandbox$ git archive --format=tar [email protected]: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

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

我使用这个命令来拉动当前主版本到我的服务器:

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

这是否帮助?

+0

是,类似的东西。我认为我也可以通过SSH获得它,但可能不是。我发现这些步骤(https://help.github.com/articles/downloading-files-from-the-command-line)与令牌,而不是密码,但这是行不通的。 – Bruce

+0

我以前也试过这个教程,它对我也不起作用... :)如果答案有帮助,欢迎来到V;) – SimonW

+0

有没有人使用ssh找到git归档的解决方案?我也面临同样的问题。 – Nandha

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 
相关问题