Skip to content

Instantly share code, notes, and snippets.

@twisty
Last active October 4, 2019 23:45
Show Gist options
  • Save twisty/5300915 to your computer and use it in GitHub Desktop.
Save twisty/5300915 to your computer and use it in GitHub Desktop.
Notes on setting up git on a Synology NAS

Setup NAS

Using the DSM web interface:

  1. Install git from the package at http://www.synocommunity.com/
  2. Create a 'git' user account.
  3. Allow terminal (ssh) access.

See this guide for more details on the next bit:

ssh in as root and set the following in: /etc/ssh/sshd_config:

PermitUserEnvironment yes

Next, restart sshd (just reboot).

ssh in as the git user and create this file: ~/.ssh/environment with these contents:

PATH=/usr/local/git/bin/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

Initialise repos

ssh in to the NAS:

ssh git@synology.local

Create a bare repo:

mkdir ~/my-repo.git  
cd ~/my-repo.git  
git --bare init

TODO: should really change git user's shell to to git-shell now.

Push to repo on NAS

From your local git repo:

git remote add origin git@synology.local:my-repo.git  
git push origin --all
@twisty
Copy link
Author

twisty commented Sep 14, 2015

This isn't needed anymore, because a git server is now available as an official Synology package.

@cfollet
Copy link

cfollet commented Mar 6, 2017

Really nice effort

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