Instructions for setting up a git server on a Synology NAS with Diskstation
- Create user gituseron NAS (with File Station and WebDAV privilages)
- Add new shared folder for the repos volume1/homes/gituser/gitwith read/write access forgituserandadmin
- Install Git Server package via Diskstation
- Open Git Server and allow gituserpermissions
- Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service)
Configure SSH Access
- create ~/.sshfolder for gituser on server
ssh [email protected]
mkdir /volume1/homes/gituser/.ssh
- copy public rsa key from local computer to gituser account on server
scp ~/.ssh/id_rsa.pub [email protected]:/volume1/homes/gituser/.ssh
- rename id_rsa.pubtoauthorized_keyson NAS (or append if already exists,cat id_rsa.pub >> authorized_keys)
ssh [email protected]
mv /volume1/homes/gituser/.ssh/id_rsa.pub /volume1/homes/gituser/.ssh/authorized_keys
- change permissions as root
cd /volume1/homes/gituser/
chown -R gituser:users .ssh
chmod 700 .ssh
chmod 644 .ssh/authorized_keys
- change ssh config to allow for key validation
ssh [email protected]
cd /volume1/homes/gituser
vim /etc/ssh/sshd_config
WARNING: If you happen to do something foolish here, you may lock yourself out of being able to connect via SSH as gituser, root, admin, and everyone else. In the event this happens, you can change the sshd_config file back by using telnet to connect instead of SSH (make sure telnet is enabled via the web interface).
- uncomment these lines (save in vim :wand then quit:q)
PubkeyAuthentication yes
AuthorizedKeysFile     .ssh/authorized_keys
- create bare repo as root
ssh [email protected]
cd /volume1/git/
git --bare init <git-repo>.git
chown -R gituser:users gitproject.git
cd <git-repo>.git
git update-server-info
- Clone repo from NAS
git clone ssh://[email protected]/volume1/git/myproject.git
References: http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html http://stackoverflow.com/questions/20074692/set-up-git-on-a-nas-with-synologys-official-package http://www.heidilux.com/2014/02/setup-git-server-synology-nas/

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