Set up GIT on a NAS with Synology's official package

FR073N picture FR073N · Nov 19, 2013 · Viewed 94.6k times · Source

I bought 2-3 months ago a Synology 213air NAS for programing purpose.

Then before trying to set up git manually on my NAS, I heard that DSM4.3 will propose Synology's official package. So I decided to wait.

The DSM4.3 with Git package is now out : http://www.synology.fr/dsm/dsm_app.php#Git, but there is no tutorial for beginners like me to set up Git.

So :

  • How do we do to set up this official package ?
  • How can I create a repo with one of my projects on my NAS ?
  • Finally, how will I do to "interact" with my project ?

Answer

zako42 picture zako42 · Dec 23, 2013

I found some helpful info on the Synology forum here:

http://forum.synology.com/enu/viewtopic.php?f=190&t=73064

First you should install the package via your Diskstation package manager and enable it. This will create a Git folder on the NAS. I created a user called "gituser" and granted it read/write permissions to the Git folder. You don't need to do that, but I like to create users specifically for different functions on the NAS. From there, you will need to set up your repository manually, because there is no graphical interface provided by Synology yet.

To create a repository, you will need to enable SSH for your NAS. Go to the control panel --> terminal --> enable SSH service and make sure it's enabled. Now SSH to it using the admin account / password. cd to the volume you created for the NAS (probably volume1). There should be the git folder there. cd to it and create your repository there.

for example:

ssh admin@nas
cd volume1/git
git init --bare --shared reponame.git
(add files, etc)

Then using an account which has access to the git folder, you should be able to pull and push, etc.