Optmize git clone.

A step to improve #2999 

@ussuri