Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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://me@192.168.0.124/volume1/path/to/test (fetch)
nas ssh://me@192.168.0.124/volume1/path/to/test (push)
$ git push nas master
me@192.168.0.124'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:

$ $PATH
-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
test.git

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.

share|improve this question

2 Answers 2

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.

share|improve this answer
    
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 '12 at 21:39
    
updated my answer with links. –  adymitruk May 30 '12 at 21:39

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)

/home/<yourUser>/.ssh/environment

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)

/etc/ssh/sshd_config

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.