Git server on Synology NAS: installation and configurations

The following guide show how to install, configure and use a Git server on Synology NAS. It is tested on Synology DS115j with DSM 5.1.

1. Installing Git Server

From the DSM’s dashboard (as admin/root user) install and configure the Git Server package:

  1. Go on the Package Center and install the Git Server package.
  2. Enable SSH Service from Control Panel > Terminal & SNMP.
  3. Enable user’s home directory from Control Panel > User > Advanced.
  4. Create one or more users that will use Git from their local PC and add them in the administrators group from Control Panel > User > Edit.
  5. Allow users to use Git from Main Menu > Git Server.

Create the Git directory

Create a new directory named git, inside /volumes1, that will contains all your Git’s repositories:

$ # Login via SSH on Synology NAS
$ ssh root@[syn-ip-addr]
$ # Create the directory
$ mkdir /volumes1/git
$ chown -R admin:administrators git
$ chmod -R 772 git


  •  [syn_ip_addr] is the Synology’s IP LAN address (e.g.

NOTE: you should use the root user and not the admin user in order to have full read/write permissions on the server. The root’s password is the same of admin’s password.

2. Creating a new shared repository on the server

A shared repository will be used to keep a centralized copy of the git repo. All users working on the repo will get a clone on their local PC and will get/send changes with pull/push git commands.

The following command creates a new shared git repository on the server (your Synology NAS):

$ ssh admin@[syn-ip-addr]
$ cd /volumes1/git
$ git init --bare --shared [my-project].git


  • [my-project] is the repository name.
  • [syn-ip-addr] is the Synology’s IP address.

See here for more informations about git shared repositories.

3. Use the repository on your local PC

Finally, a user can clone an existing repository on his/her local PC, or can connect an existing local repo to one shared on the Git server.

Cloning a repository

Use this command to get the shared repository on your local PC:

$ git clone ssh://[git-user]@[syn-ip-addr]/volume1/git/[my-project].git


  • [git-user] is the git user (e.g. netgloo).
  • [syn-ip-addr] is the Synology’s IP address.
  • [my-project] is the repository name.

NOTE: will be created a new folder [my-project] on your PC.

Connect an existing local repository with the server

Instead of cloning an empty repository, it may be that you already have a local project and want to connect it with the server.

You can do it in this way (from your PC):

$ cd [project-folder]
$ # Create the Git repository (if there is not already one)
$ git init
$ # Add the server's URL
$ git remote add origin ssh://[git-user]@[syn-ip-addr]/volume1/git/[my-project].git
$ # Make the first commit and push the project on the server
$ git add --all
$ git commit -a -m "Initial commit message"
$ git push -u origin master

Useful Tips

1) Commit without password

Follow this procedure to make commits without insert your password, using public key authentication.

Generate a key pair on your PC with the following command if you don’t already have one:

$ # Check if you already have an SSH key on your PC with:
$ ll ~/.ssh/
$ # If you don't have a public key, generate it with:
$ ssh-keygen -t rsa
$ # Then type
$ ssh-add

Copy the public key in the home of your user in the Synology server (the user you want to use with Git):

$ # Copy the key on the server
$ scp /home/[your-pc-user]/.ssh/  root@[syn-ip-addr]:/volume1/homes/[git-user]/
$ # Access the server via ssh and put the key inside .ssh directory
$ ssh root@[syn-ip-addr]
$ cd /volume1/homes/[git-user]
$ mkdir .ssh
$ mv .ssh/authorized_keys
$ # Set right owner and permissions
$ chown -R [git-user]:users .ssh 
$ chmod 700 .ssh
$ chmod 644 .ssh/authorized_keys

Repeat the above steps for each user you want to enable to Git, generating a personal key pair for each of them.

Enable the key based authentication on the server:

$ ssh root@[syn-ip-addr]
$ vi /etc/ssh/sshd_config

Decomment the following lines:

PubkeyAuthentication yes
AuthorizedKeysFile     .ssh/authorized_keys

Reboot the system, then try to clone a Git repository from the server through your git user:

$ git clone ssh://[git-user]@[syn-ip-addr]/volume1/git/[my-project].git

It should works without asking you the password.

Troubleshooting: if the authentication without password doesn’t works

Try with the following steps on the Synology server.

$ # Login via SSH on Synology NAS
$ ssh root@[syn-ip-addr]

1. Change permissions for the user’s home:

$ chmod 755 [user-home]

2. Change the user’s shell:

$ vi /etc/passwd

on the row of git user change last part to:


3. Reboot the Synology

4. Try to access the server without the password, e.g. trying a git clone or git push: now it should works!

5. If it works, you can try to restore user’s home permissions and the user’s shell.

2) Set an existing repository as shared

A repository needs to be shared if more than one user is working on the repo itself, so all users belonging to the same group (e.g. the group administrators) can send changes on the repo.

If you created a repo as no shared, following commands, executed on the server, allow to make shared an existing repository:

$ cd [my-project].git
$ git config core.sharedRepository group
$ chgrp -R administrators .
$ chmod -R g+w .
$ chmod g-w objects/pack/*
$ chmod g+s `find . -type d` 

Where administrators is the group name and [my-project].git the repository directory.

See here for more details.

Commons Git commands

See this other post for more commons git commands.


  • Niklas

    Really good guide, but I have problems getting ssh keys to work any suggestions on how to troubleshoot? Any logs I can check?

  • Frank

    Hi Thanks for the guide. I get stuck because my gituser is not part of the administrators group and hence Synology will deny its access via ssh or telnet. How can you get around this problem without putting the user in administrators group?

    • Hi Frank, we used the administrator group for all our users.. Anyway the ssh access should works also for other groups.

      You can try to open the file ‘/etc/passwd’ (using vim):

      $ vim /etc/passwd

      then searching the line for your user and change the last path with /bin/sh or /bin/ash, for example:


      will became:


      If ssh is correctly enabled it should works (independently by the group).

      Note that you will have to set right group and right permissions when you create both the git folder and the Git repository.

  • Alessandro Candini

    This guide is simply amazing, thank you!

  • Lori

    Hi thanks for the guide. Never the less i didn’t get it working. When accessing my remote repository form my local pc I always get a message “Error encountered while pushing branch to the remote repository: Git failed with a fatal error. Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.” I am able to logon on my NAS with my gituser via ssh. I have copied the local ssh key there but the connection doesn’t work. Any tips how i can proceed finding the error?

    • Dani

      same thing happened to me 🙁 I did the whole process 3 times, each single time I get:
      “fatal: ‘/MyfileName/MyProjectName.git’ does not appear to be a git repository
      fatal: Could not read from remote repository.
      Please make sure you have the correct access rights
      and the repository exists.”


Category BootstrapCategory CoffeescriptCategory DrupalCategory GravCategory HTMLCategory JavascriptCategory JoomlaCategory jQueryCategory LaravelCategory MagentoCategory PHPCategory SharePointCategory SpringCategory ThymeleafCategory WordPressCategory Workflow


Developed and designed by Netgloo
© 2019 Netgloo