factor git command running out into its own method so that failure logic can be shared across all invocations.