我试图git克隆LibreOffice代码库,但目前我有一个大约300kbps的互联网连接,它只是什么都不稳定。我可以在任何时候恢复连接,但是git克隆进程已经停止工作,没有办法让它再次运行。有没有什么方法可以让git克隆下载更具抗失败性?

我自己考虑的一个选择是下载别人的.git目录,但这过于依赖他人,对我来说似乎不是最好的解决方案。


当前回答

git clone --depth <Number> <repository> --branch <branch name> --single-branch

这个命令帮助了我(感谢尼古拉·帕鲁奇)

例如

git clone --depth 1 https://github.com/gokhanmoral/siyahkernel3 --branch ics  --single-branch

其他回答

同样的问题-我有一个非常脆弱的互联网连接,通常不超过10-15 kb/秒:- p

对我来说,wget方法非常有效。

转到有“克隆或下载”绿色按钮的存储库站点,单击它并复制ZIP下载选项的链接。

然后插入到wget命令的链接:

wget -c -m -np https://github.com/your/repository/archive/master.zip

工作起来很有魅力……

我想到的两种解决方案(或者说是变通方法)是:

Use shallow clone i.e. git clone --depth=1, then deepen this clone using git fetch --depth=N, with increasing N. You can use git fetch --unshallow (since 1.8.0.3) to download all remaining revisions. Ask somebody to bundle up to some tagged release (see git-bundle(1) manpage). The bundle itself is an ordinary file, which you can download any way, via HTTP/FTP with resume support, via BitTorrent, via rsync, etc. The you can create clone from bundle, fix configuration, and do further fetches from official LibreOffice repository.

您可以尝试在hg-git扩展中使用mercurial。

如果这不起作用,你可以使用git fetch <commit-id>来获取远程git存储库的一部分(你可以获取一个空的git存储库,没有必要使用clone来创建它)。但是当您使用这种方法时,您可能需要纠正分支配置(=创建本地和远程跟踪分支)。

对我来说最有效的解决方法是:

我也遇到过同样的问题,因为网络连接不好。所以我想出了以下解决方案:

我在服务器上创建了一个小的php文件,以zip文件的形式下载包:

<?php
$url = "https://codeload.github.com/CocoaPods/Specs/zip/master";
file_put_contents("coco.zip", fopen($url, 'r'));
?>  

<a href="coco.zip">coco.zip</a>

然后使用任何支持恢复的下载管理器下载zip文件。

如果我们假设服务器有良好的带宽(并且你有一个服务器),另一个答案是:

使用服务器端Git包装器创建自己的服务器 在您的服务器中克隆它 使用服务器端Zip Archiver's进行压缩 从服务器端简历下载

但这只适用于非常基本的web开发经验;) 此外,你还需要在你的服务器上安装git.exe