Progress indicator for git clone
Is it possible to get a progress bar when doing a
git clone? I’m wondering because I am currently doing a git clone that has taken a few minutes so far and would be curious to know if it is going to finish soon.
5 Solutions collect form web for “Progress indicator for git clone”
Not really. There are various stages to
- discover the objects that need to be sent (“Counting objects: nnn”)
- compress and send those objects
- index the received pack
- check out received files
Stage 1 involves walking through the commit graph from each branch head finding all the commits and associated objects: since there is no idea beforehand of how many commits there are, the progress of this can’t be gauged. Sadly this is often where a lot of the time in a clone operation is taken up.
Stage 2 does have a progress counter, although it counts objects rather than volume (so its rate varies, especially if the repo has large blobs)
Stages 3 and 4 have progress counters, although they are usually much faster than the previous two stages.
You can do:
du -s .git
to monitor changes in the size of temporary content to get an idea.
watch du -s .git
allows you to monitor without having to retype the command. Something like the one-liner below will give periodically you the data accumulation rate in kB per second:
delay=5; prev=`du -sk .git/ | cut -f 1`; sleep $delay; while true; do cur=`du -sk .git/ | cut -f 1`; expr \( $cur - $prev \) / $delay ; prev=$cur; sleep $delay; done
I am currently doing a git clone that has taken a few minutes so far and would be curious to know if it is going to finish soon.
With Git 2.10 (Q3 2016),
git clone --progress will be more verbose.
See commit 38e590e by Jeff King (
(Merged by Junio C Hamano in commit a58a8e3 Aug. 4th 2016)
clone: use a real progress meter for connectivity check
Because the initial connectivity check for a cloned
repository can be slow, 0781aa4 (
clone: let the user know
check_everything_connectedis run, 2013-05-03) added a
“fake” progress meter; we simply say “
when it starts, and “
done” at the end, with nothing between.
check_connected()now knows how to do a real progress
meter, we can drop our fake one and use that one instead.
You might want to take a look at the folder
While cloning, there should be a file starting with
tmp_pack_. It contains the currently downloading git pack.
With this information you might be able to eyeball the duration.
git clone --progress ?