Because I am using now a long time my Qnap server as home server in meantime for media streaming and as NAS file storage system, I tried now to use it as source control server for my personal projects too. My requirement was to have a source control system also for my IOS projects and Windows Visual Studio projects. So my decision was to use GIT.
Because it was a little bit tricky to install, here are my installation steps:
Installing GIT for Windows
Download and install Git for Windows at
Also you need PuTTY for the ssh connection to remote control the Qnap system.
# ipkg install git
# ipkg install gitosis
Check the passwd file at the Qnap system if the Gitosis user is created and the
home directory for the user exists. If not, create the user with the Qnap Web interface.
Maybe you have to login the user (no password)
at the web file system interface of Qnap to create the home directory.
1.$ cd ~/.ssh // move to dir where keys are normally stored
2.$ ls // list contents of .ssh directory
3.id_rsa id_rsa.pub known_hosts public.ppk
4.// here you can see I have an existing pair of msys keys
5.$ mkdir key_backup // make a directory to move old keys
6.$ cp id_rsa* key_backup // copy keys to key_backup dir
7.$ rm id_rsa* // remove original keys
Generate public and private key pair at the windows client and transfer it to the
Qnap system. Then you can do the git administration from this client.
1.$ ssh-keygen -t rsa -C "email@example.com"
2.Generating public/private rsa key pair.
3.Enter file in which to save the key (/c/documents/<user>/ssh/id_rsa):
4.Enter passphrase (empty for no passphrase):
5.Enter same passphrase again:
6.Your identification has been saved in /c/documents/<user>/ssh/id_rsa.
7.Your public key has been saved in /c/documents/<user>/ssh/id_rsa.pub.
8.The key fingerprint is:
copy public Key to your Qnap host:
scp ~/.ssh/id_rsa.pub admin@<host>:/tmp/
Generate ECDSA Key if it not exists in /opt/etc/openssh:
/share/MD0_DATA/.qpkg/Optware/bin/ssh-keygen -t ecdsa -f /opt/etc/openssh/ssh_host_ecdsa_key -N ''
Init Gitosis with the public key of your administration windows client:
sudo -H -u gitosis /opt/bin/gitosis-init < /tmp/id_rsa.pub
the following folders should be genarted in the referenced home directory of the gitosis user (see passwd file)
-> here gitosis-admin.git
change access rights:
chmod 755 /share/HDA_DATA/gitosis/repositories/gitosis-admin.git/hooks/post-update
Change standard port of the Qnap SSH over Web interface
change port from 22 to 2201 for SSH. You have to change the remote control SSH session to the new port. The port 22 is now used by Gitosis with Openssh.
# ipkg install openssh openssh-sftp-server
You can configure OpenSSH with the file '/opt/etc/openssh/sshd_config' (note: not ssh_config!).
After you have made your changes, you need to reload the daemon configuration:
# /opt/etc/init.d/S40sshd reload
I changed this value of my sshd_config:
AllowUsers gitosis <--- make gitosis the only user authorized
PermitUserEnvironment yes <--- load user environment (home directory)
Subsystem sftp /opt/libexec/sftp-server
# /opt/etc/init.d/S40sshd start
# /opt/etc/init.d/S40sshd restart
# git clone gitosis@host:gitosis-admin.git
Maybe you have to delete the known_hosts file in ~/.ssh at the windows client
Further informations: http://wiki.qnap.com/wiki/Gitosis