Not able to clone large repo code on git

前端 未结 3 1727
死守一世寂寞
死守一世寂寞 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:34
    git config --global http.postBuffer 524288000
    
    git clone repo_url --depth 1
    

    I have followed above steps and finally I have successfully cloned my code.

    0 讨论(0)
  • 2021-01-12 10:36

    That looks like a curl error, typical of a slow internet connection which closes too soon.

    As seen here, try a shallow clone (or switch to ssh)

    git clone https://ramweexcel@bitbucket.org/weexcel1/higher-education-haryana.g‌​it --depth 1
    

    Even then, as I documented in 2011, you might need to raise the http.postBuffer

    git config --global http.postBuffer 524288000
    

    But the idea remains: starting with one commit depth can help.

    From there, you can gradually increase the depth:

    git fetch --depth=<number-of-commits>
    

    And, after a few iteration:

    git fetch --unshallow
    
    0 讨论(0)
  • 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 <repo_URI>
    

    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
    
    0 讨论(0)
提交回复
热议问题