Ran into the same problem. The trick is to add the safe directory system-wide:
git config --system --add safe.directory <path/to/directory>