agajdosi

I had a workflow running successfully on default ubuntu-latest host on Github Actions which I wanted to also run on Debian and Fedora images. When I copied the workflow and started it on default Debian and Fedora images from Docker hub, I saw a strange error with Git:

Run git submodule update --init bk_proxor
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

To my surprise what is a Git repository on Ubuntu is not a repo on Fedora and Debian. Setting environmental variable GITDISCOVERYACROSS_FILESYSTEM to 1 or True did not help...

After some searching and few trials I have fixed the problem by adding the working directory as a safe directory to global git config:

git config --global --add safe.directory $PWD

Why is this a problem? I do not know! But if you ever face the not a git repository error on custom Docker image in Github actions while seeing that you have .git in current workdir, give the command above a try.