Don't read git files if they are unreadable.

Also print warnings if the file is not readable. Fixes #1585.
Merge remote-tracking branch 'upstream/master'