Exit gracefully if git fails.

@nuoyan r?