Using git with sparkleshare on my cloud mirror

I installed the available git package, set up ssh access with authorized keys, created a git repository on a share, and tried to connect via a sparkleshare (mac) client. It connects fine as far as ssh goes, but chokes in connecting to git.  I have heard that this is possible, but I am stumped as to how to set it up.  Are there pointers anywhere?

Thanks,

John

So I decided that if I could not run sparkleshare directly on the NAS, that I could mount the NAS under a VMware Linux machine, and install SparkleShare on that. I discover that my chief problem was having created a git repository not using the “git init --bare” flag. Running the dazzle script illuminated the process, and created a repository that I was able to connect to on the Mac. I am still testing, but when I’m done, I’ll try to post some instructions, so that this process is less mysterious.

Hello,

Please note that making this type of modifications could void the warranty. Read our “important note” located here:

http://community.wd.com/t5/WD-My-Cloud/New-Release-WD-My-Cloud-Firmware-Release-4-00-00-607-7-9-14/td-p/761150

I understand the warranty issue, but this is not an apt-get package that we are talking about. Since git appears to be an officially supported app provided in the WD interface, there ought to be some provision for normal usage of it.  I am posting instructions that follow, that do not require any non-supported third pary apps.

Sparkleshare Setup for My Cloud Mirror as abstracted from the Dazzle Script

The dazzle script sets up a user and group, etc. which can be done, but for the sake of simplicity, the default sshd user can be used. It may be possible to create a different ssh user, but I did not explore this. I have not tried these instructions, as I used the dazzle script on the my cloud mirror share, mounted on a linux box. If I create additional repositories, I will be doing this.

  1. Install the git app on the my cloud mirror from the my cloud dashboard/web interface.

  2. Create a share, and possibly a subfolder that will be used house the git repository. In the ssh terminal, cd to the relevant share/folder.

  3. Create a repository using "git init --bare It is essential to use the “–bare” flag so that sparkleshare can find it.

  4. Run additional git commands to make the repository suitable for Sparkleshare:

git config --file “/config” receive.denyNonFastForwards true

  1. Add the following lines to the /info/attributes file in order to prevent useless compression (add any other file types if relevant):

*.jpg -delta

*.JPG -delta

*.jpeg -delta

*.JPEG -delta

*.png -delta

*.PNG -delta

*.tiff -delta

*.TIFF -delta

*.gif -delta

*.GIF -delta

*.flac -delta

*.FLAC -delta

*.mp3 -delta

*.MP3 -delta

*.ogg -delta

*.OGG -delta

*.oga -delta

*.OGA -delta

*.avi -delta

*.AVI -delta

*.mov -delta

*.MOV -delta

*.mpg -delta

*.MPG -delta

*.mpeg -delta

*.MPEG -delta

*.mkv -delta

*.MKV -delta

*.ogv -delta

*.OGV -delta

*.ogx -delta

*.OGX -delta

*.webm -delta

*.WEBM -delta

*.zip -delta

*.ZIP -delta

*.gz -delta

*.GZ -delta

*.bz -delta

*.BZ -delta

*.bz2 -delta

*.BZ2 -delta

*.rpm -delta

*.RPM -delta

*.deb -delta

*.DEB -delta

*.tgz -delta

*.TGZ -delta

*.rar -delta

*.RAR -delta

*.ace -delta

*.ACE -delta

*.7z -delta

*.7Z -delta

*.pak -delta

*.PAK -delta

*.iso -delta

*.ISO -delta

*.dmg -delta

*.DMG -delta

  1. The script now sets ownership and group for the git user, which I don’t think is relevant for my cloud mirror. If you manage to create a separate user, you may need to do this. The repository must have permissions as set by:

chmod -R o-rwx ,

but I’m not sure if this is necessary either. That should be all in creating the repository.

  1. On the client(s) machine(s) find or create a private and public ssh key, e.g. on a mac, run ssh-keygen in a terminal. Copy the public key (e.g. on a mac, in $HOME/.ssh/id_rsa.pub).

The ssh home directory on the My Cloud is /home/root. From there, cd into the .ssh folder and create (if it does not already exist) a text file called “authorized_keys”. Paste the public key into this file, and append the public keys for any other clients you wish to connect to sparkleshare.

NOTE:  the “authorized_keys” file must be chmod 600 and the .ssh folder must be chmod 700 in order to work.  E.g. use the command “chmod 600 authorized_keys” and “chmod 700 .” from the .ssh folder while in the ssh terminal, in the .ssh folder.

  1. If the public key is set up properly, you should now be able to ssh login to your My Cloud without a password, since the authentication is done with the keys.

  2. Install sparkleshare on the machine where you just set up the ssh keys. Click “add a hosted project”, and then select “my own server”. For the address, use ssh://sshd@hostname. You can use the IP address for the hostname, but if you want to used it outside the network, it would be advisable to set up a dyndns address pointing to ssh on your network. For the remote path, use /shares/sharename/subfolder/, depending on where you put the repository.

  3. If everthing went well, you should now have Sparkleshare up and running, and files will automatically sync between client machines, just like dropbox.

NOTES:

a. I have this working on a mac, but not yet on windows, due to the kludges needed to get ssh forwarding or tunneling working on windows. If anyone gets this working, please share your secrets. I have tried a couple of putty variations with no success.

b. the mobile (e.g. iPad) client depends on the additional installation of a sparkleshare dashboard on the server, which may be a no go on the my cloud. My workaround was to create another folder(s) on the my cloud and do a git clone, to check out the files. I just use the my cloud app to access the files that way, and iSSH to sync the repositories as needed. Not elegant, but it works.

A follow-up post with a solution and a problem.

I got sparkleshare working on Windows 7.  The Sparkleshare package has a version of git for windows included, including an ssh client for git.  I never got the connection working, but for another project, I installed the full git for windows, which made it easier to get the ssh portion running.  After that, I resintalled Sparkleshare, and everything just worked.

I found other advice to run git through putty and related accessories.  This is at best a kludge and not desirable.  The essential thing to do is to install the authorized_key file on the WD Box and get git working on windows.  If you can open a git bash shell and ssh to the WD Box without a password, then everything should work for Sparkleshare.

PROBLEM:

Make sure that you keep a copy of the Authorized_Keys file somewhere safe, as the WD Cloud Mirror will delete the .ssh directory from the root directory with no warning, and you will have to put it back.  If this happens,

  1. Ssh to the WD box (this puts you in the /home/root user directory by default).

  2. Create the .ssh folder

  3. Copy the Authorized_Keys file to the .ssh folder.

  4. chmod 600 Authorized_Keys

  5. chmod 700 .ssh (folder)

TO WD PRODUCT SUPPORT MANAGERS:

Please fix the WD My Cloud Mirror, so that configuration files placed in the /home/root folder are not arbirarily deleted by the system - thanks!