【问题标题】:Unable to push using Eclipse/Egit to repository over SSH with git-receive-pack and git-upload-pack set无法使用 Eclipse/Egit 通过 SSH 推送到带有 git-receive-pack 和 git-upload-pack 集的存储库
【发布时间】:2013-06-26 11:39:45
【问题描述】:

标题几乎说明了一切:

我正在使用带有 EGit 插件 (2.2.0) 的 Eclipse (Juno SR2)。

我有一个使用 SSH 设置的远程存储库,因为远程没有设置 gitd,并且因为 git 工具不在路径上,所以我在配置文件中有以下设置:

[remote "origin"]
    url = ssh://moi@fully.qualified.host/home/colleague/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    uploadpack = ~colleague/bin/git-upload-pack
    receivepack = ~colleague/bin/git-receive-pack

从命令行执行一个普通的git push 会显示服务器的安全警告,然后提示我输入我的 ssh 密码,然后完美推送。

但是在 Eclipse 中,我收到一个带有服务器警告的弹出窗口,然后像以前一样提示我输入密码,一切正常,然后推送的提交列表的最终确认是空的,顶部有一个错误

ssh://moi@fully.qualified.host/home/colleague/repo.git: push not permitted

我在一个尚未推送到远程的新分支中,如果这有什么不同的话。

有人见过这个吗?

【问题讨论】:

  • 您可以尝试使用绝对路径,即/home/colleague/bin/git-upload-pack吗?
  • 我试过了,但恐怕没有乐趣。

标签: eclipse git egit git-push


【解决方案1】:

对于追随我的同一个兔子洞的任何人......

我找到了解决方法。您无法在存储库配置中设置接收和上传包的位置,因此必须从您的配置中删除:

[remote "origin"]
    receivepack = /blah/bin/git-receive-pack
    uploadpack = /blah/bin/git-upload-pack

我正在远程使用 Bash shell,在 .bashrc 的开头,当 shell 非交互式时它退出之前,该位置被添加到路径中,如下所示:

# If not running interactively, most of what follows is not worth doing
if [ -z "$PS1" ] ; then
  # Make sure my extra stuff is on the path even in non-intaractive shells (I'm looking at you SSH!)
  export PATH=/blah/bin:$PATH
  return
fi

我现在可以从本地命令行或通过 Eclipse/EGit 推送。但是,作为一种妥协,我当然降低了非交互式 shell 的安全性。

【讨论】:

    猜你喜欢
    • 2012-07-30
    • 2020-09-15
    • 2013-09-19
    • 2021-11-28
    相关资源
    最近更新 更多