Enable SSH key login for Git on Synology Diskstation Server
Git can be enabled on a Diskstation easily using DSM, and will work as expected. However, it always requests you to enter your password. Here is a little description how to replace the password entry by a keyfile.
First, in DSM enable the „User Home“ Service at „User / Advanced“.
Then, execute the following commands on your local machine (you can replace “root“ by a user with the desired privileges; „username“ should be replaced by the username you use for git):
$ ssh-keygen # just hit enter without entering anything, creates the files ~/.ssh/id_rs and ~/.ssh/id_rsa.pub
$ scp -P 22 ~/.ssh/id_rsa.pub root@diskstation:/volume1/homes/username # copy the public file to the remote server
$ ssh root@diskstation # login to diskstation
on the diskstation:
> mkdir /volume1/homes/username/.ssh
> cat /volume1/homes/username/id_rsa.pub >> /volume1/homes/username/.ssh/authorized_keys
> rm /volume1/homes/username/id_rsa.pub
now you can use eg. ...
$ git push
... without the need of entering a password :-)
[inspired by http://sniptools.com/mac-osx/save-ssh-password-in-terminal