Introduction
For backing up important repositories, I’ve chosen to use Gitea, a self-hosted Git service. This post covers a simple deployment using Docker and how to work around SSH limitations.
Deployment with Docker
The simplest approach is to deploy Gitea using Docker. However, this method makes it challenging to passthrough the SSH port between the container and the host.
I’m ok with that and use the HTTPS protocol instead.
Adding Gitea as a Remote
To add Gitea as a second remote to your repository:
git remote add gitea http://192.168.1.104:3000/your-name/your-repo.git
git push gitea your-branch
To set Gitea as the main upstream remote:
git push --set-upstream gitea your-branch
# OR shorthand
git push -u gitea your-branch
Result
After setting up your Gitea instance and pushing your repositories, you should see something like this:
Conclusion
By self-hosting Gitea, you gain control over your code backups and version management.