It seems to be related to #1076750, and I found a possible workaround in https://bugs.gentoo.org/932091 is to add some environment variables to the git-daemon startup script to disable the owner checks in git-daemon only.
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0="*" See especially https://bugs.gentoo.org/932091#c2 Thanks, Johannes