Build a Git Server on Synology NAS and Back It Up with Hyper Backup

Use Synology NAS as a lightweight Git server and configure Hyper Backup to protect the repositories.

Synology NAS can be used as a lightweight private Git server. For personal projects or a small team, this is often enough: repositories stay inside the LAN, access can be managed through NAS accounts, and the data can be backed up with Synology’s built-in tools.

This note records the basic setup idea and the backup workflow with Hyper Backup.

Install Git Server

Open Package Center on Synology DSM and install the Git Server package.

After installation, open Git Server and allow the required users to use Git over SSH. The NAS account must have SSH access and permission to the folder where repositories are stored.

Prepare A Repository Directory

Create a shared folder or a subdirectory for Git repositories, for example:

1
/volume1/git

Inside this directory, create bare repositories:

1
git init --bare project.git

A bare repository does not contain a working tree. It is suitable for use as a remote repository.

Connect From A Client

From another machine, clone the repository through SSH:

1
git clone user@nas-ip:/volume1/git/project.git

You can also add it as a remote in an existing local project:

1
2
git remote add origin user@nas-ip:/volume1/git/project.git
git push -u origin master

If SSH uses a non-standard port, specify it in the SSH configuration or use a custom remote URL.

Permissions

Make sure the repository directory belongs to the correct user or group. If multiple users need access, assign them to a shared group and grant read/write permission to the Git folder.

When push fails, check these items first:

  • whether SSH login works;
  • whether the user is allowed in Git Server;
  • whether the folder permission is writable;
  • whether the repository was initialized as bare;
  • whether the remote URL is correct.

Back Up With Hyper Backup

After repositories are stored on the NAS, configure Hyper Backup to back up the Git directory.

In Hyper Backup:

  1. Create a new backup task.
  2. Select the destination, such as another disk, another NAS, rsync server or cloud storage.
  3. Select the Git repository folder.
  4. Configure the schedule.
  5. Enable version retention if needed.

This protects the repository data against disk failure, accidental deletion or wrong pushes.

Restore Notes

When restoring, recover the whole bare repository directory. After restoration, test with:

1
git clone user@nas-ip:/volume1/git/project.git

If cloning works, the repository is usable again.

Summary

Synology Git Server is simple, but it is enough for many private repositories. The important points are SSH access, correct folder permissions, bare repositories and a reliable Hyper Backup task.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy