Updated Nov 23, 2026· 8 min read

Key takeaways

  • Run Gitea in Docker on your NAS and host your own Git repositories. Setup, SSH keys, backups, webhooks, and safe remote access explained step by step.

As an Amazon Associate we earn from qualifying purchases.

Every developer eventually faces the same quiet choice: keep every repository on someone else’s servers, or bring the code home. GitHub and GitLab are easy, fast, and free for most personal work, and for most people they are the right answer. A NAS git server is the opposite trade: full control over where your code lives, who can see it, and what happens to it, in exchange for your time. If the NAS dies and the repositories were never backed up, the code is gone.

This guide is for a narrow audience, and it says so plainly: developers who already own a NAS and want their private projects under their own roof. It walks through Gitea in Docker, the simplest reliable way to run a git server at home, covering the admin account, SSH keys, repositories, webhooks, and the backup routine that keeps a dead NAS from taking every project with it. If you only need a place to store finished code, a plain shared folder is simpler.

How to Choose

Gitea or a Bare Repository

A bare repository is the simplest git server there is: a folder on the NAS that Git can push to over SSH, with no web page, no user accounts, and no extra software. It suits one person who only needs a remote copy of their own work. Gitea is a small web application that adds a familiar interface, user accounts, pull requests, and an issue tracker. It needs Docker and a little more memory. Choose a bare repository if you work alone and only want a private remote. Choose Gitea if anyone else will ever push code, or if you like the workflow of pull requests and issue tracking.

Docker or a Native Package

Some NAS brands offer Gitea as a native package you install with one click, while others only support it through Docker. The native package feels simpler at first, but it ties you to the version your NAS vendor ships, and updates arrive slowly or not at all. Docker keeps Gitea in a container with its own version, and you update it by pulling a new image and recreating the container. That is more work, but it is the same work every time, and it works the same way on every NAS that runs Docker. If your NAS offers a current native package and you only want a quick setup, take it. For everyone else, Docker is the safer long-term choice.

SSH, HTTPS, or Local Only

How people reach the server decides how much security work you take on. Local only means the git server is reachable from inside your home network and nowhere else, the safest option for most people. SSH access lets you push and pull from anywhere, but it means opening a port and protecting it with keys, not passwords. HTTPS through a reverse proxy gives you a web address and a browser login, convenient for a small team, but it also puts your login page on the internet. Choose local only unless you truly need outside access. If you do open it up, HTTPS is not optional, and password login should be turned off.

How Much the Server Needs to Hold

A git server holds text, and text is small. A hundred small projects may take less space than a single family photo folder, and a modest NAS handles that easily. The picture changes when repositories hold large binary files, build outputs, or design assets, because Git stores every version of every file forever. Two gigabytes of storage, plus room for the database and logs, is a comfortable minimum for a small Gitea install. A single drive is enough to run, but one drive is a file server, not a NAS with protection, so use at least two drives in a mirrored or parity volume if the code matters to you. Plan the backup before you create the first repository.

Step-by-Step

Create a shared folder on the NAS for the git data, and keep it separate from your media and document folders so a backup job can target it alone. Open the Docker package on the NAS and pull the official Gitea image, then create a container with two volumes: one for the Gitea data and one for the repositories themselves. Map the web port to 3000 and the SSH port to 2222 so they do not clash with anything the NAS already runs. Give the container a fixed amount of memory, at least one gigabyte, and set it to run automatically when the NAS boots. If the container fails to boot, check the volume paths first, since a wrong folder mapping is the most common cause of a Gitea container that exits at once. Check the container log once after the first boot to confirm Gitea reports itself ready and listening on both ports before you open the installer.

Open the Gitea web installer in a browser at the NAS address on port 3000. Choose SQLite for a small install or MariaDB if you expect more users, then create the admin account with a strong password and an email address you actually read. Turn off open registration right away so strangers cannot create accounts, and turn off password login for SSH so only keys work. Add your SSH public key to your Gitea profile, then test a push and a clone from your computer to confirm both directions work.

Create a repository in the web interface and clone it, then make a small commit and push it back to prove the whole loop. When you create the first repository, set the default branch name to match the one your team already uses, so every clone behaves the same way. If you want automatic builds or notifications, add a webhook to the repository and point it at the service that should receive it, then trigger a push and confirm the message arrives. For access from outside the home, place a reverse proxy in front of Gitea and give it a proper certificate so the login page is always served over HTTPS. Finally, set up the backup: copy the repository folder and the database to a second location on a schedule, and restore from that copy once to prove it works. A backup that has never been restored is a hope, not a backup. Write down the admin password and the port numbers in a safe place, because a forgotten admin password on a server you rarely log into is a common way to lock yourself out of your own code.

Which One Fits Your Situation

A Solo Developer Moving Off GitHub

You want your private projects under your own control, with nobody else involved. Run Gitea in Docker, keep it local only, and use a bare repository if the web interface feels like overkill. The backup is a weekly copy of the repository folder to an external drive. This is the simplest setup in this guide, and it is the one most readers should choose.

A Small Team Sharing Private Code

Two to five people need to push to the same repositories, and they need accounts, permissions, and a way to see each other’s work. Gitea with a MariaDB database is the right call, and a reverse proxy with HTTPS lets the team reach it from outside the office or home. Turn off open registration, give each person their own account, and keep the admin account separate from daily work.

A Family or Hobby Group Keeping Projects Together

The code is a side project, not a job, and the group cares more about not losing work than about fancy workflow features. Keep the server local only, use Gitea so everyone can browse the code, and set up the backup before the first repository is created. A weekly copy to a USB drive is enough, and the person who owns the NAS should own the backup routine too.

A Homelab Owner Who Wants Full Control

You already run services in Docker and want Git to join them. Put Gitea behind your existing reverse proxy, give it its own subdomain, and wire webhooks into your other services. Keep the repository data on its own volume so you can move it or back it up without touching the rest of the system. This is the most flexible setup, and also the one that needs the most attention when something breaks.

Common Mistakes

  • Leaving open registration turned on, so anyone who finds the login page can create an account.
  • Skipping the backup, then discovering the repository data was the one folder no backup job ever touched.
  • Using a password for SSH instead of a key, which invites automated login attempts the moment the port is open.
  • Exposing the web interface over plain HTTP, so the admin password travels across the internet in the clear.
  • Storing large binary files in Git, where every version is kept forever and the repository grows without ever shrinking.

Frequently Asked Questions

Do I need a static IP or a domain to reach Gitea from outside my home?

No, but you need one of the two. A domain with dynamic DNS updates itself when your home address changes, and a reverse proxy gives Gitea a clean address. A static IP works too, but it is harder to remember. Most home setups use a free dynamic DNS name. Whatever you choose, serve the site over HTTPS with a real certificate, and never expose the plain HTTP port.

Can I move existing repositories from GitHub to my NAS?

Yes, and the move is simple. In Gitea, create a new repository, choose the migration option, then paste the GitHub repository address and your access token. Gitea copies the branches, tags, and history, and the old repository stays untouched. For a private repository without web history, a mirror clone followed by a push to the NAS works as well. Keep the GitHub copy until you confirm history arrived in full.

What happens to my repositories if a NAS drive fails?

It depends on your volume and your backup. A mirrored or parity volume survives one failed drive: replace the drive and let the volume rebuild. A single drive does not survive, and neither does a volume that loses more drives than it can tolerate. So the backup matters most. A separate copy of the repository data and the database, stored elsewhere, is what saves the code when the NAS dies.

Is Gitea safe to expose to the internet?

It can be, but only with care. Keep Gitea updated, turn off open registration, require strong passwords, serve everything over HTTPS, and use SSH keys instead of passwords. A reverse proxy in front of Gitea adds another layer, and limit SSH access to known addresses. If that list sounds like too much work, keep the server local only. A git server nobody outside your home can reach is the safest.

A
affadmin
We compare specs, materials and verified owner reviews before a product earns a spot. Rankings are never paid.
Affiliate disclosure. As an Amazon Associate we earn from qualifying purchases at no extra cost to you. Prices accurate as of the date shown.

More from Amazon

Programs that pair well with the guide above. Offers and eligibility are set by Amazon and may change.

Amazon Business

A free business account with business pricing and bulk-buying tools for work, shop or home office.

Create a business account
Amazon Prime

Free shipping on eligible items, Prime Video and more. Eligible new members can start with a free trial.

Start a Prime free trial
Audible

Audiobooks and podcasts to listen to on the go. Eligible new members can start with a free trial.

Try Audible free
Amazon Music Unlimited

Ad-free music streaming. Eligible new subscribers can start with a free trial.

Try Music Unlimited free

As an Amazon Associate we earn from qualifying purchases.