Configuring the version management service in the NAS at home can greatly facilitate the daily work of the SOHO family. This article demonstrates how to configure the git server service in a Synology nas

Install Git Server suite

In the Synology Nas suite, the Git Server is already included. we need only install it.

In Synology Nas suite window, search ‘Git Server’ in all suite tab, then install it.

After installation, you need to choose which users can use the git server.

Create Git repositiry

To set up a Git repository on a NAS, we first turn on the SSH function of the NAS. Then use ssh to log in to nas to set it up.

Let’s take the example of setting up a repository for Java SE projects to demonstrate the entire process and related commands: (Suppose the repository to be built is named javase)

  1. Log in to the NAS with ssh

  2. Switch to the /volume1/GitRepos directory and create a new one if it does not exist

1
cd /volume1/GitRepos
  1. Create a folder for repository
1
mkdir javase.git
  1. Enter the folder
1
cd javase.git
  1. Initial reposiory

Execute the following commmand:

1
git --bare init
1
git update-server-info
  1. Change the permission of the folder.
1
cd ..
1
chown -R xxx:xxx javase.git

Steps 6 is mainly to assign permissions to the directory, which in my NAS can be omitted because the logged-in user is directly authorized

Use the git client to access the repository

On the client side, you can use the following url to clone the repository:

1
git clone ssh://xxx@hohistar.synology.me/volume1/GitRepos/javase.git