fixes #4559 - check git file exists before trying to read it