How to Host Private Git Repositories for Free With Forgejo
Explore Forgejo's free, open-source Git forge for private repositories, team access, issue tracking, HTTPS and backup planning on a self-hosted server.
Before you begin
Software projects become difficult to manage when code is exchanged in ZIP attachments or edited directly on a production server. Git provides version history, while a forge adds repository hosting, users, issues and review workflows. Forgejo is a community-oriented, free, open-source, self-hosted Git forge with supported installation and administration guidance. It offers a way to keep project source on infrastructure you control, though the server, domain, updates and backups still require time or money. For beginners, the first goal is one private repository with a verified backup—not a public production service offering every developer feature.
1Choose a supported Forgejo deployment method
Begin at forgejo.org and read its current installation and administration documentation. The project offers supported binary and container-based installation paths, with version-specific requirements for operating system, database and Git. Select a maintained method you can upgrade, preferably on a dedicated test host. Do not assume the server will be free to operate merely because the software is free; cloud VM, DNS and storage may incur costs. Keep the service private on a local network while learning. Obtain packages from recognized release channels and check compatibility before copying commands from old Gitea tutorials.
2Configure the service securely before creating users
Create a dedicated system account or supported container setup and choose persistent storage directories for repository data, the database and configuration. Use a strong initial admin password and configure a trustworthy external URL. If remote access is required, set up HTTPS with valid certificates and restrict administrative routes where appropriate. Never commit database passwords, session secrets or private SSH keys into a public repository. Review whether user self-registration should be disabled on an internal team server. If the instance is reachable by outsiders, consult the official hardening and rate-limiting guidance rather than relying only on an obscure domain name.
3Create an example repository and test Git access
Sign in as an authorized user and create a private repository for a fictional project. Check that it is marked private and that a second unauthenticated browser cannot view its contents. Add a simple README with the purpose of the project, then use a supported Git client to clone and commit a harmless text file. For authenticated access, choose a documented SSH key or HTTPS credential method; avoid putting tokens inside remote URLs that might be recorded in shell history. Verify that the commit appears in the Forgejo interface. A repository marked private still requires careful collaborator management and secure host administration.
4Use issues and code review without excessive privileges
Create an issue describing a small change and link it to a branch or pull request using Forgejo's current workflow. Invite one trusted collaborator with the minimum permission needed for review. Do not grant everyone owner or administrator access to simplify setup. Review branch protection and merge controls supported by your installed release and repository configuration. Avoid placing API keys, production credentials or personal data in issue descriptions and code snippets. Review commit history for accidental secrets before pushing. If you later enable continuous integration, treat runners as powerful services with access to source and potentially deployment secrets.
5Back up, restore and maintain the forge
A complete recovery plan includes Git repositories, application data, database, attachments and the relevant configuration and secrets. Read Forgejo's official backup and restore instructions for your version rather than copying only a folder that looks like a repository. Save backups on a separate trusted destination and practice restoring the fictional project. Keep Forgejo, Git and dependencies patched using documented upgrade paths. Monitor available storage and manage inactive accounts as the team changes. If migrating from another forge, test import fidelity and user permissions before switching the production domain. A reliable self-hosted forge succeeds only when its data and security remain maintainable over time.
Frequently asked questions
Is Forgejo free and open-source Git hosting software?
Yes. Forgejo is community-driven open-source software that can be self-hosted.
Can a private Forgejo repository replace backups?
No. A repository protects version history, but loss or compromise of the server still requires independent recoverable backups.
Official sources and further reading
Interface labels, availability and policies may change. Confirm current details with the relevant service before taking action.