Question

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 ?
Was it helpful?

Solution

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.

OTHER TIPS

You never needed the Git Server package because you could locally create a bare repo and then upload that to your NAS. They you would just have to enable WebDAV to access it. The Git Server package allows you to ssh into the NAS as root and create the bare repo on the NAS instead of having to upload it. You also can enable users to use the SSH protocol instead of just HTTP/HTTPS once you install the Git Server package. I created a tutorial about it: http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html

I found this article to be really helpful: http://www.sbprojects.com/knowledge/internetwork/synologygit/index.php

In addition, here's the gitbook reference on setting up a git server: http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server You'll want to skip the adduser command, because presumably you'll be using the user accounts that are already present on the synology.

This solution is quite simple and works great for me (tested with DSM 5.1):

http://blog.netgloo.com/2015/04/20/git-server-on-synology-ds115j-installation-and-configurations/

These are the main steps:

  • Installing Git Server from the DSM’s dashboard
  • Creating a new shared repository on the server (via ssh)
  • Use the repository on your local pc
  • [Optional] Configuring for commit without password (with ssh keys)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top