this is the play.
in the past have used git-remote-gcrypt[1] with rclone.
currently using git-remote-aws[2].
both work great.
There are a number of possible solutions:
git-remote-gcrypt: https://github.com/spwhitton/git-remote-gcrypt
git-crypt: https://github.com/AGWA/git-crypt
git-secret: https://github.com/sobolevn/git-secret
However, most people who self-host their Git repository are fine with just transport-level encryption (TLS).
git-remote-gcrypt: https://github.com/spwhitton/git-remote-gcrypt
It's available in most distro repositories and works with almost any underlying remote repos.