4
votes

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 [email protected]:/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?

2
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
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
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
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

2 Answers

4
votes

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

git push [email protected]:/path/to/directory master

I this works, just change your origin remote to [email protected]:/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.

0
votes

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://[email protected]/home/myuser/path/to/repo.git
git push myremote branchnamehere