For basic repositories yes, Gitea [1], gitosis [2], gitolite [3], self hosted Gitlab, or just plain ol git over SSH. Otherwise no, not for all the work-flows and CI/CD integrations. Gitlab is not free and may or may not cover your integration use-cases but there would need to be more details in your question. I am most familiar with gitosis.

[1] - https://github.com/go-gitea/gitea

[2] - https://github.com/tv42/gitosis # some Linux repos contain this as a prebuilt package.

[3] - https://gitolite.com/gitolite/index.html#installsetup # Also contained in some Linux package managers

These are all self-hosted. Is there a non-self-hosted solution?

There are, but they would have access to your files. Self hosted is the only way I know of to prevent access and even that isn't perfect unless one fully controls the servers. VM's at VPS providers for example can be live cloned and live migrated to gather forensic data without leaving a trace for the renter of the VM.

I hesitate to append this but one option I have seen thrown around and also debated is git-crypt [1] Here [2] is a discussion on HN about git-crypt. There are many caveats to doing this as any integrations that would need to read the file contents would also need to be able to decrypt the files so this may not be entirely useful and may add many levels of complexity and fragility. In theory one could encrypt specific files and then check them into any of the cloud hosted git repositories but anything that needs to read the contents of the file will need a mechanism to decrypt them automatically. That thread also mentions transcrypt [3]

If doing this I would strongly recommend also having a local non-encrypted weekly snapshot of your files in the event that nobody is able to decrypt your committed files.

[1] - https://github.com/AGWA/git-crypt

[2] - https://news.ycombinator.com/item?id=7508734

[3] - https://github.com/elasticdog/transcrypt