美文网首页
如何拉取超大代码库?

如何拉取超大代码库?

作者: yingxl1992 | 来源:发表于2018-08-29 11:13 被阅读16次

由于公司代码库太大,每次clone代码都会失败,报错如下:

fatal: early EOF
fatal: index-pack failed

这次由于换了电脑,尝试解决了这个问题,借此机会做下记录。(原理暂未研究)

第一步:持续执行以下命令

  1. git config --global core.compression 0

  2. git clone --depth 1 <repo_URI>

  3. git fetch --unshallow

  4. git pull --all

到此已将代码库拉取下来,但是却没有任何分支

第二步:同步远程分支

  1. 执行git config --get remote.origin.fetch,查看结果是否为+refs/heads/*:refs/remotes/origin/*,如果不是,则执行git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

  2. 若需要拉取dev分支,则执行git fetch origin dev获取远程dev分支,然后执行git checkout -b dev origin/dev来建立分支

参考:https://stackoverflow.com/questions/21277806/fatal-early-eof-fatal-index-pack-failed

https://codeday.me/bug/20170916/71884.html

相关文章

网友评论

      本文标题:如何拉取超大代码库?

      本文链接:https://www.haomeiwen.com/subject/ldehwftx.html