Backport #29155 with an extra change: tolerate the git 2.43.1 GIT_FLUSH
bug in Gitea 1.21.x, more details in the comment of repo_attribute.go
Manually tested with git 2.43.1 and an old git (2.39.2)
log.Error("installed git version %s has a known compatibility issue with Gitea: %s, please downgrade (or upgrade) your git",gitVersion.String(),err.Error())
// Due to CVE-2022-24765, git now denies access to git directories which are not owned by current user
// Due to CVE-2022-24765, git now denies access to git directories which are not owned by current user.
// however, some docker users and samba users find it difficult to configure their systems so that Gitea's git repositories are owned by the Gitea user. (Possibly Windows Service users - but ownership in this case should really be set correctly on the filesystem.)
// However, some docker users and samba users find it difficult to configure their systems correctly,
// see issue: https://github.com/go-gitea/gitea/issues/19455
// so that Gitea's git repositories are owned by the Gitea user.
// Fundamentally the problem lies with the uid-gid-mapping mechanism for filesystems in docker on windows (and to a lesser extent samba).
// (Possibly Windows Service users - but ownership in this case should really be set correctly on the filesystem.)
// Docker's configuration mechanism for local filesystems provides no way of setting this mapping and although there is a mechanism for setting this uid through using cifs mounting it is complicated and essentially undocumented
// See issue: https://github.com/go-gitea/gitea/issues/19455
// Thus the owner uid/gid for files on these filesystems will be marked as root.
// As Gitea now always use its internal git config file, and access to the git repositories is managed through Gitea,
// As Gitea now always use its internal git config file, and access to the git repositories is managed through Gitea,
// it is now safe to set "safe.directory=*" for internal usage only.
// it is now safe to set "safe.directory=*" for internal usage only.
// Please note: the wildcard "*" is only supported by Git 2.30.4/2.31.3/2.32.2/2.33.3/2.34.3/2.35.3/2.36 and later
// Although this setting is only supported by some new git versions, it is also tolerated by earlier versions
// Although only supported by Git 2.30.4/2.31.3/2.32.2/2.33.3/2.34.3/2.35.3/2.36 and later - this setting is tolerated by earlier versions