If you really need to commit private files to GitHub, use Turbocrypt https://github.com/jedisct1/turbocrypt/blob/main/docs/git.md
Or git-crypt, which has been around for over a decade: https://github.com/agwa/git-crypt
Or git-crypt, which has been around for over a decade: https://github.com/agwa/git-crypt