improve handling of Git errors