Don’t use git if there is no .git directory

@embray - this seems to fix https://github.com/astropy/astropy/issues/2926

By the way, I noticed that astropy core is still using the old ``ah_bootstrap.py`` - is that intentional, or should we update it?