When github git clone fails with early EOF and index-pack failed
For the past year, I have been majorly working on Native Mobile apps for iOS & Android using Xamarin. Its fantastic!! I can share code, and create beautiful apps for both iOS & Android, using my favourite programming language C#. Yeah you read it right, C SHARP!! And best of all I get to use Visual Studio too with Resharper!!
In one of my recent projects, we wanted to use System.Runtime.Caching.MemoryCache to track our objects and keep it in-memory cache. This has been added to Mono in version 2.8. The problem arose when I realised that MonoTouch & MonoDroid as based on Mono 2.1 and thus the mentioned class is unavailable for use.
So, I decided to extract the code from the latest Mono and create a library for our use. So I fired up the below Git query:
git clone https://github.com/mono/mono.git
No matter how many times I tried, it always ended with the error:
Cloning into 'mono'... fatal: early EOF fatal: index-pack failed
So I searched around and found that this happens if the repo is very big, like “mono” in my instance. The solution is simple, modify the git query:
git clone -depth 1 https://github.com/mono/mono.git
That’s it. This prompts git to only query the latest git changes and thus your repo size reduces and can easily be cloned.
The only problem with this is, you will not be able to push any changes. If you want to push any changes, then change the depth to 1000000 and you are done.