-
-
Save loochao/9c92d0b5e1b2e4f2ef3f3ba4ad4f2545 to your computer and use it in GitHub Desktop.
Instructions for setting up git server on Synology Diskstation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Instructions for setting up a git server on a Synology NAS with Diskstation | |
| - Install Git Server package via Diskstation | |
| - Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service) | |
| - Create user `gituser` on NAS (with WebDAV privilages) | |
| - Add new shared folder called `git` (e.g. `/volume1/git`) with read/write access for `gituser` and `admin` | |
| Configure SSH Access | |
| - create `~/.ssh` folder 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.pub` to `authorized_keys` on 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 | |
| ``` | |
| - uncomment these lines (save in vim `:w` and then quit `:q`) | |
| ``` | |
| PubkeyAuthentication yes | |
| AuthorizedKeysFile .ssh/authorized_keys | |
| ``` | |
| ## Setting up a New Repo on NAS | |
| ## Add NAS as Remote for Local Repo | |
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment