Workaround git 2 issue with fetching remote hashes

sub-optimal, as it will access the network twice, but it should be more
robust, and well, it's a workaround...
Closes #1847