Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone issue: repo too large? (50m)

Been having an issue with being unable to clone a git repo. It starts to run and then cancels half way through. My current git repo size is 53.7 MB Git version is 1.7.12.4 on server and on my remote.

Error below:

MacBook-Pro:htdocs macbook$ git clone [email protected]:~/opt/git/myrepo.git 
Cloning into 'myrepo'...
[email protected]'s password:
remote: Counting objects: 8888, done.
remote: Compressing objects: 100% (7185/7185), done.
Write failed: Broken pipe267/8888), 1.03 MiB | 1001.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

I created a fresh new repo, clones just fine. Once I add my site files to it and push them to the remote though. I can no longer clone from it. But I can pull from it just fine.

I added this with no luck:

[core]
    compression = -1
[pack]
    windowMemory = 10m
    packSizeLimit = 20m

I tried upping these both to way higher values. No luck

I also tried running git gc --aggressive and git gc --prune on the remote repo.

I've seen this post, but mine is no where as large (1g+) Also see a people having issues with the git versions not matching, but this isn't the case ether.

like image 992
Josh Avatar asked Dec 06 '22 01:12

Josh


1 Answers

I think the problem you are having is your clone breaks off in the middle every time.

So, instead of cloning a repo again and again from scratch everytime, I would suggest you instead do a fetch on a freshly created repo.

Basically, initialize an empty repository

cd repo_name && git init

Add the original repo as a remote in this repo

git remote add origin url/to/repo

And now do a git fetch.

This way, even if your clone breaks in the middle, fetch will take care to bring in unfetched objects only in next run.


Alternatively, you can check the solutions here and here.

like image 97
Anshul Goyal Avatar answered Dec 20 '22 15:12

Anshul Goyal