Self Hosting Git Repo
You set up a self hosting git repo by running a Git server on your own machine. You then add user keys and set role rules to control code pushes. Teams often pick this path to keep source code on private servers. They set up a Linux host, create a shared system user, and add developer keys. Many teams also run a web app on top to manage branches and pull requests. Problems start when admins grant broad write roles or share one SSH key across the team. A single broad role lets anyone change live
Self-Service Access Portals + Git Commit Signing (GPG, SSH): the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up a self hosting git repo by running a Git server on your own machine. You then add user keys and set role rules to control code pushes.
Teams often pick this path to keep source code on private servers. They set up a Linux host, create a shared system user, and add developer keys. Many teams also run a web app on top to manage branches and pull requests. Problems start when admins grant broad write roles or share one SSH key across the team. A single broad role lets anyone change live branches or read private scripts.
How a self hosting git repo works in practice
A self hosting git repo uses standard network protocols to move code between machines. Most teams choose SSH or HTTPS to handle these user logins. When a developer pushes code over SSH, the server checks their public key. That key maps to a system account on the host machine. The server then checks file permissions on the bare Git directory.
If you run a full Git web app, the app manages these files for you. Admins create groups and assign read or write roles to each project. You can also set branch rules to block direct pushes to the main code line. These rules ask for a peer check before any new code merges. The server logs who logged in and which project they opened.
What native Git roles solve and what they miss
Native Git server roles are good at blocking strangers at the front door. They decide which user can read a project or push to a branch. Branch rules also help stop basic mistakes during daily code merges. For routine code storage, these built-in checks work well.
Yet native roles only check who logs in to the server. They do not inspect what happens inside the shell session after login. If an engineer needs host shell access to fix a broken repo, they get broad rights. Once on the host, a user with admin rights can read any file. They can also bypass branch rules or delete old audit logs on disk.
Self-Service Access Portals + Git Commit Signing (GPG, SSH): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static SSH keys and long-lived tokens create another big risk for your team. Developers store these keys on laptops for months or even years. If a laptop gets lost, someone can use that key right away. Native Git servers also cannot mask private data inside terminal output during maintenance. If a script prints customer emails, phone numbers, or card numbers, the terminal shows them. Teams need a way to control each command and protect data in flight.
Securing host maintenance and automated jobs
Running your own Git server means you must maintain the underlying Linux host. Admins log in to update packages, check disk space, and run backups. Build servers also connect to pull code and run test scripts. In many setups, these build bots use static keys with wide read rights.
To reduce risk, teams should separate daily Git pushes from host shell logins. Developers should only run Git transfer commands, not full interactive shells. When an admin needs a full shell to fix the server, that session needs strict rules. Each command should go through an approval step and leave a clear audit trail. Redacting sensitive fields like national IDs or emails in results keeps private data safe.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Should we use SSH or HTTPS for our Git server?
Both protocols work well when you keep keys and tokens short-lived. SSH is popular for command line work, while HTTPS fits well with single sign-on systems.
How do we back up a private Git server safely?
You should snapshot the bare repo folders and the app database on a set schedule. Store those backup files on a separate host with strict read roles.
Why are shared deploy keys risky for build servers?
A shared key makes it impossible to see which specific person or bot pulled code. If that single key leaks, an attacker can read every project tied to it.
Related guides
In this post