Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
  • Open Git Server and allow gituser permissions
  • Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service)

Configure SSH Access

  • create ~/.ssh folder for gituser on server
ssh admin@diskstation.local
mkdir /volume1/homes/gituser/.ssh
  • copy public rsa key from local computer to gituser account on server
scp ~/.ssh/ admin@diskstation.local:/volume1/homes/gituser/.ssh
  • connect via SSH as root and rename to authorized_keys on NAS (or append if already exists, cat >> authorized_keys)
ssh root@diskstation.local
mv /volume1/homes/gituser/.ssh/ /volume1/homes/gituser/.ssh/authorized_keys
  • change permissions while logged in as root
cd /volume1/homes/gituser/
chown -R gituser:users .ssh
chmod 700 .ssh
chmod 644 .ssh/authorized_keys

Set Up New Repo on NAS

  • create bare repo as root
ssh root@diskstation.local
cd /volume1/git/
git --bare init <repo-name>.git
chown -R gituser:users <repo-name>.git
cd <repo-name>.git
git update-server-info

NOTE: I'm not entirely sure if git update-server-info must be run for each repo or just initially. It seems to work without running this command, but I'm suspcicious that it might cause problems later.

Add NAS as Remote for Local Repo

  • Clone repo from NAS
git clone ssh://gituser@diskstation.local/volume1/git/<repo-name>.git


gazgeek commented Aug 19, 2015


Just wanted to say thanks - this has been really helpful in getting git up and running on my DS415+.

I ran in to a couple of issues.

  • I had to specify --shared in the git init command otherwise I got errors about the config directory being inaccessible...

git init --bare --shared <repo-name>.git

  • I couldn't get the password-less login to work unless I set the authorized_keys permissions to 600...

chmod 600 .ssh/authorized_keys



Thanks for the post!

  • To make "password-less ssh" work, aside from @gazgeek's suggestion, I also find out that I need to change the permission of the user folder (that contains .ssh) to 755. Previously it was 711:
chmod 755 /home/gituser


jgudpns commented Nov 6, 2015

Jeff - Trying to do this to my DS214, but I get stuck on understanding about how to get the rsa keys and where on my local (pc?) this would be.

Also - does "diskstation.local" by the name of the DS214?

eyesuk commented Jan 3, 2016

Does anyone know if this package includes jekyll functionality like github?

@eyesuk You could add git commit hooks on the server so that it built the jekyll site on every push up to it. You could then symlink the output directory to the web folder on the NAS and follow the steps here

There is no /volume1/homes/ directory. Any other options or do I have to create them?

Is there any GUI I can use with this? because the shell isn't that practical

Thank you for this!

greyshine commented Feb 5, 2017

Thank you for your post.
I do stumble with "Open Git Server and allow gituser permissions".
I do not find anything to edit anything with the installed Git server.

As I understand it from your explanation, there is a Git-Server/Settings/Users navigation path to manage/add users.

Note: I just found it. I always looked at the installed packages in the Package Center. But it is located at the "Main Menu". The place where all installed applications have their starting home.

Another issue I watched (if I got it right):
It is metioned that git update-server-info is somewhat needed; probably also or instead it is needed to set the chown again. I had the 'feeling' that the git server places new files into his .git folder with root:root ownershipwhich breaks the git commands executed as/from client.

ockertbotha commented Feb 10, 2017

ssh as root is no longer supported
ssh root@diskstation.local


ssh admin@diskstation.local
sudo -i

git clone ssh://gituser@diskstation.local/volume1/git/< repo-name >.git

Can be shorten to -> git clone ssh://diskstation/git/< repo-name >.git


  1. change diskstation by editing ~/.ssh/config . Example

  2. symlink git in root(/) to target git folder as above /volume1/git

aalaran commented Jul 5, 2017

git update-server-info saved me a headache. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment