Don't call out to git if we're sure it will fail

Calling out to `git` only to have it fail, turns to eat up a fair bit of time when doing `import astropy`.  We can also just detect the presence of a git repository by looking for the `.git` directory, which is much faster.  While I suppose `git` could change its internal representation to do something else in the future, there are *many* tools that rely on this trick (like bash completion etc.) such that it's unlikely to change without fanfare and hand-wringing.