git Push over sshfs 失败,并显示“关闭 sha1 文件时出错:错误的文件描述符”

发布于 2024-10-14 18:40:49 字数 1314 浏览 7 评论 0原文

我们使用 sshfs 通过 SSH 安装文件系统,并将其用作 git 存储库协作的远程存储。

Mac OSX 10.6.6 到 RHEL 3 服务器 SSHFS 版本 2.2(MacFUSE SSHFS 2.2.0)
MacFUSE 库版本:FUSE 2.7.3 / MacFUSE 2.0.3

sshfs -o workaround=rename [email protected]:/path/to/directory ~/git

下面是我们如何创建我们的存储库,在本地使用它们,然后尝试推送回服务器:

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/'

奇怪的是看来对存储库的小编辑成功推送,但包含多个新文件或大量编辑的较大提交不起作用。

我们是 sshfs 和 MacFuse 新手,但也是中级 git 用户。

有什么想法或建议吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我做我的改变 2024-10-21 18:40:49

Git 可以本地通过 SSH 进行推送,而无需将服务器安装到本地文件系统。
我建议尝试这个:

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

我这有效,只需将您的原始远程更改为 [email&n公共服务提供商;protected]:/path/to/directory 而不是 ~/git

如果它不起作用,它至少会告诉我们 MacFuse 或 sshfs 不可用归咎于。

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.

国粹 2024-10-21 18:40:49

我们从未找到解决通过 sshfs 安装服务器时遇到的问题的方法。但我的一位同事确实弄清楚了如何在 RHEL 3 服务器上的单个帐户中本地安装 git 二进制文件,我们现在可以通过 SSH 与远程存储库进行通信,现在可以完美运行。

以下是他使用的安装命令,通过 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

接下来,通过编辑将远程帐户的 bin 目录添加到服务器帐户的 PATH 中在服务器上的 ~/.bashrc 并将此行添加到末尾:

export PATH=$PATH:$HOME/bin

然后,您可以从您的开发计算机定义远程存储库位置并将其推送到该位置。

git add remote myremote ssh://[email protected]/home/myuser/path/to/repo.git
git push myremote branchnamehere

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文