I'm setting up a NAS server with Git for the first time, so please forgive the noobish questions (it also means I am super thankful for any detailed explanations you can give me, because I am kind of a fish out of water on this).

Here's what I've done so far:

  1. List item
  2. Set up NAS
  3. Installed git, following these instructions: http://www.wonko.de/2010/04/set-up-git-on-synology-nas.html (I made it until the end of step 5)
  4. Have git working on my local computer (did git init and initial commit)

Right now, I'm trying to figure out how to do step 6 of that guide (http://www.wonko.de/2010/04/set-up-git-on-synology-nas.html) so that I can use git clone and git push to send commits of my local to my NAS.

I read the comments below that post, and have tried the following:

  • Created a file called environment saved in my local home folder: .ssh/environment with the following typed in there: PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

  • Logged in to my NAS using ssh://root@ipaddresstonas, and typed: cd /usr/bin ln -s /opt/bin/git*

However, I keep getting these results:

Terminal on my local machine:

$ git remote -v
nas ssh://[email protected]/volume1/path/to/test (fetch)
nas ssh://[email protected]/volume1/path/to/test (push)
$ git push nas master
[email protected]'s password: 
sh: git-receive-pack: not found
fatal: The remote end hung up unexpectedly

And when I try typing $PATH in my local machine:

-bash: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin: No such file or directory

On my NAS:

nas> cd /volume1/path/to/test
nas> ls

nas> $PATH
-sh: /opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin: not found

Also, just a note: I'm using Synology DS212J, which I think uses "BusyBox" if that's any help.

I'm really confused on how to set up git to work with my NAS...how I can push to my NAS, how I can clone (or svn checkout equivalent) onto another computer etc.

2 Answers 2


The path in unix is a variable which contains the locations for various programs.

If you type in a command like whoami, the shell looks at all the folders listed in your $PATH.

Go ahead and type which whoami in your shell. You will see that whoami is likely located in /usr/bin/whoami.

By having /usr/bin in your path, it makes it so you can just type whoami instead of /usr/bin/whoami. It is kind of like having a shortcut.

The article you are reading shows that git-upload-pack installs to a location that the shell doesn't automatically look in for executables. You need to add /opt/bin and /opt/sbin to your path so the shell can 'find' git-upload-pack

There are multiple ways to add a directory to a path. I prefer to put it in /etc/profile.d however it appears that busy box does not 'look' in that directory. Instead, it will need to be added to the ~/.ssh/environment file. The environment file is parsed when a user connects over ssh to the server.

Step 6

Use a text editor to edit the following file (it likely doesn't exist yet)


Add the following line to /home//.ssh/environment

export PATH=$PATH:/opt/bin:/opt/bin

Then edit the following file (you will need to be root to do this)


In that file, you will find the phrase #PermitUserEnvironment no

Remove the comment (#) and change no to yes

Restart your ssh service, or just reboot the whole device.

You can test that it worked, but running the following command

echo $PATH |grep '/opt/bin'

If it returns something, then everything should work.


set up an rsa key. Add the source IP to the list of trusted ones on the remote. Generate a key without a password. Run the git daemon on the other machine.

Test your authentication with ssh on the client machine.

  • Could you go over that in more detail please? I have actually already generated the key, and edited it into the root/.ssh/authorized_keys file of the NAS.
    – Jay
    May 30, 2012 at 21:39
  • updated my answer with links.
    – adymitruk
    May 30, 2012 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .