git push over sshfs failing with “error when closing sha1 file: Bad file descriptor”

StackOverflow https://stackoverflow.com/questions/4819834

  •  26-10-2019
  •  | 
  •  

Pergunta

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?

Foi útil?

Solução 2

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top