How to clone a large git repository

Recently, I needed to clone the ndk while downloading andorid 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.

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded
Tags:

Leave a Reply