How to clone a large Git repository ?

Recently, I needed to clone the ndk while downloading Android source, ndk size to clone was more than 4GB and my internet speed 512KB, which could take around 20 hours to clone. And, as you know if for any reason, Internet disconnects before git clone is 100%, the entire git needed to be clone from beginning. So, since my Internet was unstable and also with very slow speed, following is the method, I used to clone the git repository, which is bigger and in multiples of GB.

$ git clone https://android.googlesource.com/platform/prebuilts/ndk --depth=1

one the above command clones, current source code, you can download all the history using below shell script,

$ vim fetch.sh

copy, paste below code into fetch.sh & save.

#!/bin/bash

cd ndk
for i in `seq 1 100000`
do
git fetch --depth=$i
echo "fetching iteration / depth $i"
done

Now, run the script as,

$ ./fetch.sh

and wait the code to download rest of the branches & git history.


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


1 thought on “How to clone a large Git repository ?”

Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded