4

We are mounting a filesystem over SSH using sshfs and are using it as a remote storage for git repository collaboration.

Mac OSX 10.6.6 to a RHEL 3 server SSHFS version 2.2 (MacFUSE SSHFS 2.2.0)
MacFUSE library version: FUSE 2.7.3 / MacFUSE 2.0.3

sshfs -o workaround=rename gituser@gitserver.ourdomain.com:/path/to/directory ~/git

Here's how we're creating our repo's, working with them locally, then trying to push back to the server:

cd ~/git/mypersonaluser
git init --bare --share mynewrepo.git
git clone ~/git/mypersonaluser/mynewrepo.git ~/Desktop/mynewrepo
cd ~/Desktop/mynewrepo
... make a few edits to the repo ...
git push origin master

Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 20.82 KiB | 23 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
fatal: error when closing sha1 file: Bad file descriptor
error: unpack failed: unpack-objects abnormal exit
To /Users/joebob/git/mypersonaluser/mynewrepo.git/
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to '/Users/joebob/git/mypersonaluser/mynewrepo.git/'

What's weird is it appears that small edits to the repo push successfully, but that larger commits with multiple new files or large amounts of edits do not work.

We're sshfs and MacFuse newbies, but intermediate git users.

Any ideas or suggestions?

John Kary
  • 6,703
  • 1
  • 24
  • 24
  • I forgot to say: git binaries are NOT installed on our remote server, which is why we needed to mount over sshfs, so we could use tools on our local machines. – John Kary Feb 01 '11 at 15:52
  • Did you managed to solve this? I'm having the same problem using macfusion, and can not use the direct git ssh version either because there are no git binaries on the server. – Hugo Feb 15 '11 at 22:29
  • No real solution yet. The problem seems to be exacerbated when we connect over VPN from a remote location. The issues seem to appear less frequently when connected over gigabit LAN. We're wondering if it's also difficulty in how our VPN is setup + maybe some latency issues. We've also had some memory issues on our server, which may only compound what's going on. Sometimes the remote repo branch gets corrupted, then we have to kill the branch and re-push it and it works. Puzzled are we. – John Kary Feb 16 '11 at 16:45
  • I've had exactly the same issue. The only "solution" I've found is to install git locally on the target machine and run it through a terminal prompt. – bjornl Oct 02 '13 at 04:50

2 Answers2

4

Git can push over SSH natively without having to mount the server to the local filesystem. I would recommend trying this:

git push gituser@gitserver.ourdomain.com:/path/to/directory master

I this works, just change your origin remote to gituser@gitserver.ourdomain.com:/path/to/directory instead of ~/git

If it doesn't work either it will at least tell us that MacFuse or sshfs isn't to blame.

araqnid
  • 127,052
  • 24
  • 157
  • 134
jonescb
  • 22,013
  • 7
  • 46
  • 42
  • We tried going over SSH natively before going the route of sshfs, and gave the same result below. This is the error when trying to issue your command: `bash: line 1: git-receive-pack: command not found` – John Kary Jan 28 '11 at 02:30
  • I looked up a few other threads related to that error, which suggested adding `export PATH=$PATH:/usr/local/bin` to `~/.bashrc` or `/etc/rc.common` on my local machine and that did not solve the problem. I also tried `which git-receive-pack` on my local machine which resulted in `/usr/local/bin/git-receive-pack`. – John Kary Jan 28 '11 at 02:39
  • Also I should note git binaries are NOT installed on our remote server, which is why we needed to mount over sshfs, so we could use tools on our local machines. – John Kary Jan 28 '11 at 02:55
0

We never found a fix to the issues we experienced when mounting the server over sshfs. But a co-worker of mine did figure out how to install the git binaries locally within a single account on the RHEL 3 server and we can now communicate with our remote repositories over SSH, which now works flawlessly.

Here are the install commands he used, which should be used when logged in to your server via SSH:

curl -O http://kernel.org/pub/software/scm/git/git-1.7.4.1.tar.gz
tar xvfz git-1.7.4.1.tar.gz
cd git-1.7.4.1
./configure --prefix=$HOME CFLAGS='-I/usr/kerberos/include'
make SHELL="/bin/bash" install

Next, add your remote account's bin directory to the server account's PATH by editing ~/.bashrc on the server and adding this line to the end:

export PATH=$PATH:$HOME/bin

From your development machine, you can then define a remote repository location and push to it.

git add remote myremote ssh://myuser@server.domain.com/home/myuser/path/to/repo.git
git push myremote branchnamehere
John Kary
  • 6,703
  • 1
  • 24
  • 24