Not able to clone large repo code on git

前端 未结 3 1729
死守一世寂寞
死守一世寂寞 2021-01-12 10:30

I\'m getting an error like :-

Cloning into \'large-repository\'...
remote: Counting objects: 20248, done.
remote: Compressing objects: 100% (10204/10204), do         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-12 10:39

    First, try to download a smaller amount, so that when the network fails, you don't have to start from zero:
    Taken From This Answer by ingyhere

    First, turn off compression:

    git config --global core.compression 0
    

    Next, let's do a partial clone to truncate the amount of info coming down:

    git clone --depth 1 
    

    When that works, go into the new directory and retrieve the rest of the clone:

    git fetch --unshallow 
    

    or, alternately,

    git fetch --depth=2147483647
    

    Now, do a regular pull:

    git pull --all
    

    I think there is a glitch with msysgit in the 1.8.x versions that exacerbates these symptoms, so another option is to try with an earlier version of git (<= 1.8.3, I think).

    If this does not help, because your network is still too unstable or your repo still too large, try a different network - best would be a wired.

    For me, that was not an option. VonC's Answer states to do git config --global http.postBuffer 524288000. Maybe you'll need to do git config --global https.postBuffer 524288000 instead, if you're using https.

    Finally, what worked for me in the end:
    Give up and use a different machine
    If it works on your laptop, just pull that repo onto your laptop, then run

    git bundle create /my/thumb/drive/myrepo.bundle --all  
    

    And restore it on your other machine with

    git clone /my/thumb/drive/myrepo.bundle
    

提交回复
热议问题