Last active
September 27, 2025 02:50
-
Star
(275)
You must be signed in to star a gist -
Fork
(70)
You must be signed in to fork a gist
-
-
Save walkerjeffd/374750c366605cd5123d to your computer and use it in GitHub Desktop.
Revisions
-
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ 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 -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,17 @@ Configure Synology NAS as Git Server ------------------------------------ Instructions for setting up a git server on a Synology NAS with Diskstation ### 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 @@ -21,7 +26,7 @@ mkdir /volume1/homes/gituser/.ssh scp ~/.ssh/id_rsa.pub [email protected]:/volume1/homes/gituser/.ssh ``` - connect via SSH as `root` and rename `id_rsa.pub` to `authorized_keys` on NAS (or append if already exists, `cat id_rsa.pub >> authorized_keys`) ``` ssh [email protected] @@ -37,8 +42,7 @@ chmod 700 .ssh chmod 644 .ssh/authorized_keys ``` ### Set Up New Repo on NAS - create bare repo as root @@ -53,7 +57,7 @@ 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 -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 12 additions and 25 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ Instructions for setting up a git server on a Synology NAS with Diskstation - Create user `gituser` on NAS (with File Station and WebDAV privilages) - Add new shared folder for the repos called `git` (located at `/volume1/git`) with read/write access for `gituser` and `admin` - 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) @@ -21,14 +21,14 @@ mkdir /volume1/homes/gituser/.ssh scp ~/.ssh/id_rsa.pub [email protected]:/volume1/homes/gituser/.ssh ``` - ssh as `root` and rename `id_rsa.pub` to `authorized_keys` on NAS (or append if already exists, `cat id_rsa.pub >> authorized_keys`) ``` ssh root@diskstation.local mv /volume1/homes/gituser/.ssh/id_rsa.pub /volume1/homes/gituser/.ssh/authorized_keys ``` - change permissions while logged in as root ``` cd /volume1/homes/gituser/ @@ -37,22 +37,6 @@ chmod 700 .ssh chmod 644 .ssh/authorized_keys ``` ## Setting up a New Repo on NAS @@ -61,22 +45,25 @@ AuthorizedKeysFile .ssh/authorized_keys ``` ssh [email protected] 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://[email protected]/volume1/git/<repo-name>.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/ -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ Instructions for setting up a git server on a Synology NAS with Diskstation - Create user `gituser` on NAS (with File Station and WebDAV privilages) - Add new shared folder for the repos `volume1/homes/gituser/git` with read/write access for `gituser` and `admin` - Install Git Server package via Diskstation - Open Git Server and allow `gituser` permissions -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ Instructions for setting up a git server on a Synology NAS with Diskstation - Create user `gituser` on NAS (with WebDAV privilages) - Add new shared folder for the repos `volume1/homes/gituser/git` with read/write access for `gituser` and `admin` - 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 -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -44,6 +44,8 @@ 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 `:w` and then quit `:q`) ``` -
walkerjeffd renamed this gist
Jul 17, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -76,3 +76,4 @@ 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/ -
walkerjeffd revised this gist
Jul 17, 2014 . 1 changed file with 15 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -53,11 +53,24 @@ AuthorizedKeysFile .ssh/authorized_keys ## Setting up a New Repo on NAS - 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 ``` ## Add NAS as Remote for Local Repo - Clone repo from NAS ``` git clone ssh://[email protected]/volume1/git/myproject.git ``` References: -
walkerjeffd renamed this gist
Jul 17, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
walkerjeffd created this gist
Jul 17, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ 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