Only run git commands if .git exists