If a Flatpak is not mandatory, consider:
Git is a file-system-heavy application. It requires read/write access to source code directories and access to SSH keys for authentication. In a traditional Linux install, the application has implicit access to the user's home directory. In a Flatpak sandbox, this access is restricted by default. flathub github desktop