Gitea docker images greater or equal to 1.16.6 contain git version greater or equal to 2.30.3 which include the security patch. Previous docker images for Gitea have a lower version of git (for instance 1.16.5 has 2.30.2) and are not impacted.
If it is not possible for some reasons, there are workarounds. Be advised that applying these workarounds exposes the host to security risks as described in CVE-2022-24765:
The security check is triggered because the repository is owned by an unexpected user (root instead of git typically) and not because a parent directory is owned by an unexpected user. This, in itself, is a problem worth investigating but it is unrelated and was revealed by the newer security check of git even though it does not match the threat described in CVE-2022-24765.
It appears non trivial to enforce a consistent ownership of files and directories, either within docker or outside docker when network file systems are involved. The Gitea server was not troubled by this inconsistency so far because the permissions allow it to write and read where expected, regardless of the owner. Again, that does not mean it is not worth looking into, just that the problem is ancient and unrelated.
For the record, here is another instance of the problem on 1.16.8. It does not give more information but it would be worth asking the person more details about their setup. They may be willing to investigate and make a reproducer.
2022/06/23 11:18:07 ...ules/context/repo.go:592:RepoAssignment() [E] RepoAssignment Invalid repo C:\Gitea\data\gitea-repositories\skymaper\tmcplugin.git: exit status 128 - fatal: unsafe repository ('C:/Gitea/data/gitea-repositories/skymaper/tmcplugin.git' is owned by someone else)
To add an exception for this directory, call: