36

I do a git pull/clone to some repository (mainly github ones). Sometimes after a few minutes the download crashes.

Here is a log.

remote: Counting objects: 2284, done.
remote: Compressing objects: 100% (713/713), done.
fatal: The remote end hung up unexpectedlyiB | 5 KiB/s      
fatal: early EOF
fatal: index-pack failed

In my following of the process, i have noticed that i have already fetched about 4 MBs of objects. When i start the process again, it starts from the beginning. My Internet connection sucks, some times it crashes and i get disconnected unexpectedly.

My question is: Is there any way to resume the pull/clone to rescue those 4 MBs i have already fetched, and not to start again?

bpoiss
  • 13,673
  • 3
  • 35
  • 49
Javier Cadiz
  • 12,326
  • 11
  • 55
  • 76

2 Answers2

20

If a pull hung up, it will not write any changes to your filesystem. This is because, if it would, your local repository would not be in a stable state.

There is no way to resume a pull/clone. So your only choice is to pull/clone again.

bpoiss
  • 13,673
  • 3
  • 35
  • 49
  • 1
    But what about those 266 objects (in my example) already fetched ?? they are in the stable state right ?? I only need the other ones. Thanks. – Javier Cadiz Feb 06 '13 at 20:45
  • 2
    Maybe some files, but not the whole repository. I'm sorry, but there is no way to get around to start again. Maybe this helps: http://stackoverflow.com/questions/3954852/how-to-complete-a-git-clone-for-a-big-project-on-an-unstable-connection – bpoiss Feb 06 '13 at 20:47
  • Ummm... didn't Linux used to use svn? We got rid of it for this, right? Hmmm, Linus the egotist? – autistic Aug 05 '17 at 22:34
  • not real, if you git clone and interrupted just go to directory where .git is located then run git pull it will resume. – Mark Nov 18 '17 at 06:19
  • 1
    I don't see why this feature is not implemented. Its easy to check the integrity of downloaded pieces with file hashes ! – Dr Deo Jun 12 '21 at 09:12
3

cd into the the main directory and run

git fetch

tested only on linux

bpoiss
  • 13,673
  • 3
  • 35
  • 49
Storm
  • 49
  • 1
  • 3
    But what if I'm download the repo for the first time? I won't be having the .git folder of the remote repo initially. `git fetch` won't work in that case. Any alternative solution? – Rewanth Tammana Apr 10 '18 at 10:07