Questions regarding Subversion Server may go here
Forum rules
Please note the disclaimer before modifying your Synology Product.


Postby bzhou » Wed Sep 24, 2008 7:56 pm

Now gitosis is in the optware feeds, anyone want to try hosting git repositories?
Posts: 344
Joined: Sat Jan 12, 2008 1:57 am

Re: gitosis

Postby KoppeKTop » Mon Jun 13, 2011 11:00 am

I've just installed gitosis to my DS210j (3.1-1742) and want to add some advice to all, who wants to do it too.
After standart 'ipkg install gitosis' you need to do additional steps:
Change some lines in /etc/ssh/sshd_config:
Code: Select all
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
PermitUserEnvironment yes
AllowUsers gitosis root admin

Now, copy SSH public key from client computer (let's call it my_client) to NAS (i.e. to /volume1/BackUp folder)
Code: Select all
[client] $ scp ~/.ssh/ root@NAS_IP:/volume1/BackUp/

Now add this public key to authorized_keys on NAS, set .ssh/environment file (to prevent "gitosis-serve not found" error), init gitosis' keys and change mod to post-update.
Code: Select all
mkdir -p /opt/share/gitosis/.ssh
cp /volume1/BackUp/ /opt/share/gitosis/.ssh/authorized_keys
echo "PATH=/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin" > /opt/share/gitosis/.ssh/environment
sudo -H -u gitosis /opt/bin/gitosis-init < /volume1/BackUp/
chmod 755 /opt/share/gitosis/repositories/gitosis-admin.git/hooks/post-update

New system user (gitosis) does not have password, so you need to change it. It's not quite simple, because this user is not visible in web interface and there is no passwd command since DSM 3.0. I just edit /etc/shadow file and copy line from another user:
Code: Select all

In other case you will get this error message during ssh connection:
Code: Select all
[client] $ ssh gitosis@NAS_IP
Connection closed by NAS_IP
[NAS] > tail -n 2 /var/log/messages
Jun 13 11:29:20 sshd[7243]: pam_winbind(sshd:account): pam_winbind_request: write to socket failed!
Jun 13 11:29:20 sshd[7243]: pam_winbind(sshd:account): internal module error (retval = 3, user = 'gitosis')

Now you must reseive such responce:
Code: Select all
[client] $ ssh gitosis@NAS_IP
ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment.
                                              Connection to NAS_IP closed.

And you can now manage gitosis:
Code: Select all
[client] $ git clone gitosis@NAS_IP:gitosis-admin.git
I'm New!
I'm New!
Posts: 3
Joined: Fri May 27, 2011 12:48 pm

Re: gitosis

Postby ariestav » Wed Jul 27, 2011 6:23 am

Thanks for posting this. I'm running DSM 3.1-1613 on a DiskStation 1511+. I followed your directions, but when I changed the /etc/ssh/sshd_config file to allow 'PermitUserEnvironment', DSM failed to restart the ssh service via the DSM web interface. I had to telnet in to change back the sshd_config file so that SSH would start up again on my Synology. Do you know why enabling 'PermitUserEnvironment' causes SSH not to restart on the Synology?

Thanks for your time and help!
Posts: 55
Joined: Mon Aug 17, 2009 2:43 am

Return to Subversion Server

Who is online

Users browsing this forum: No registered users and 2 guests