Eri*_*ric 3 git git-clone shallow-clone git-archive
我想从项目中获取一些文件:我不需要克隆整个存储库:我只需要来自主分支的最新快照.这对我来说很重要,因为我的带宽非常低,下载所有内容需要一些时间.
在另一个问题上,我看到可以使用'git archive'这样做,不幸的是,似乎它不适用于https:
git archive --format=tar --remote=https://github.com/thomaspark/bootswatch.git master | tar tvf -
returns "fatal: Operation not supported by protocol."
Run Code Online (Sandbox Code Playgroud)
此命令与ssh://一起使用,但不与https://一起使用
对于github,我可以在Web界面上下载提供的zip文件,但对于其他没有提供它的存储库,如何从git存储库https URL获取简单快照?
你可以采取一个"浅层克隆":
git clone --depth 1 <repository>
Run Code Online (Sandbox Code Playgroud)
这只需要历史记录中的最后一个n(在这种情况下为= 1)提交; 因此需要较少的带宽.您可以在git文档中阅读更多内容
这将是一个功能齐全的git存储库; 你将能够推,拉,提交等.你自己只会拥有历史的一部分,所以这应该满足你的需要.