Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clone a large Git repository on an unreliable connection?

I want to clone LibreOffice. From the official website, this is what's written:

All our source code is hosted in git:

Clone: $ git clone git://anongit.freedesktop.org/libreoffice/core # (browse)

Clone (http): $ git clone http://anongit.freedesktop.org/git/libreoffice/core.git # slower

Tarballs: http://download.documentfoundation.org/libreoffice/src/

please find the latest versions (usually near the bottom)

now, when I write this command in git bash to clone, it starts fetching. But the repository is so big that after hours I lose connectivity for a few seconds, it rolls back the download, and I get nothing.

Is there any way I can download the repository smoothly even if interruptions occur?

P.S. I am a new user of Git and I use a 1 MB DSL internet connection. The repository must be over 1 GB.

like image 497
khunshan Avatar asked Feb 13 '12 21:02

khunshan


People also ask

How do I continue an interrupted git clone?

Restarting the clone just restarts the process, which is likely to fail again. As a workaround, use a hosted server that has good connectivity to the git repository and ssh access from your local. Clone to the server, then rsync to your local over ssh, and resume the rsync as needed.

How do I manage large git repository?

Using submodules One way out of the problem of large files is to use submodules, which enable you to manage one Git repository within another. You can create a submodule, which contains all your binary files, keeping the rest of the code separately in the parent repository, and update the submodule only when necessary.

What is a shallow git clone?

Git shallow clone lets you pull down just the latest commits, not the entire repo history. So if your project has years of history, or history from thousands of commits, you can select a particular depth to pull.


2 Answers

The repository is accessible via the http protocol (aka dumb protocol) here: http://anongit.freedesktop.org/git/libreoffice/core.git.

You can download everything here with wget or another download manager, and you'll have a clone of the repository. After that, you rename the directory from core.git to .git, and use the following command to tell git about the remote url:

$ git remote add remote http://anongit.freedesktop.org/git/libreoffice/core.git $ git reset --hard HEAD 
like image 58
Sylvain Defresne Avatar answered Sep 20 '22 01:09

Sylvain Defresne


do 'git clone --depth 100' It should grab the last 100 commits

like image 22
Paul Nikonowicz Avatar answered Sep 19 '22 01:09

Paul Nikonowicz