Fixes #5194: Initialize git repository if not present