【问题标题】:gitolite push error -> remote: ENV GL_RC not setgitolite推送错误->远程:未设置ENV GL_RC
【发布时间】:2013-05-01 18:51:15
【问题描述】:

我正在尝试将内容从工作站推送到服务器。但这给了我一个错误。请查看以下命令和错误:

Administrator@ganesh ~/testing  
$ git push origin master  
Counting objects: 3, done.  
Writing objects: 100% (3/3), 241 bytes, done.  
Total 3 (delta 0), reused 0 (delta 0)  
remote: ENV GL_RC not set  
remote: BEGIN failed--compilation aborted at hooks/update line 20.  
remote: error: hook declined to update refs/heads/master  
To git@ganesh:repositories/testing  
 ! [remote rejected] master -> master (hook declined)  
error: failed to push some refs to 'git@ganesh:repositories/testing'  

看来我需要设置环境变量GL_RC。是这样吗?

这里有人可以告诉我问题可能是什么以及如何解决吗?我在 Windows Server 2003 上使用 gitolite。

【问题讨论】:

  • 它以 'remote:' 为前缀,这意味着 gitolite 更新挂钩会打印该错误。似乎 gitolite 在存储库中未正确配置。
  • 如何发现问题?我没有得到确切的。我应该重新安装 gitolite 吗?

标签: git git-svn msysgit gitolite


【解决方案1】:

如文档ssh troubleshooting 中所示,这可能是由于克隆过程中路径不正确造成的。

文档(以下某些部分仅对 Gitolite V2 有效)提及:

第二个错误

(即。“您可以克隆存储库但无法将更改推回(该错误抱怨未设置 GL_RC 环境变量,并且挂钩/更新以某种方式失败)

如果你使用git@server:repositories/reponame.git(假设默认的$REPO_BASE设置——在Gitolite V3中,它总是~/repositories)——也就是说,你使用了完整的unix 路径
由于不需要上面提到的“前缀”,所以shell找到了repo并克隆了。
但是当你推送时,gitolite 的更新钩子会启动,并且由于它所期望的一些环境变量不存在而无法运行。

“easy-install”程序成功运行时出现的消息清楚地包括以下警告:

*Your* URL for cloning any repo on this server will be
        gitolite:reponame.git

    *Other* users you set up will have to use
        <user>@<server>:reponame.git
    However, if your server uses a non-standard ssh port, they should use
        ssh://<user>@<server>:<port>/reponame.git

所以在你的情况下,你必须克隆你的回购:

git clone git@ganesh:repositories/testing.git

代替:

git@ganesh:testing.git

【讨论】:

  • @VonC:感谢您的回答。你对我的所作所为是对的。但是当我尝试使用git clone git@ganesh:testing.git 克隆存储库时,它给出了 'testing.git 似乎不是 git 存储库' 我没有得到确切的错误或如何纠正它。你能给我一些建议吗?谢谢
  • @amar4kintu: 可以肯定的是,git clone git@ganesh:testing 返回什么? (所以,克隆没有最后的'.git')。
  • @VonC :再次感谢您的回复。它返回相同的错误 'testing' 似乎不是 git 存储库
  • @amar4kintu: 抱歉耽搁了,我得上班了 ;) 你的 .gitolite.rc 在 git 帐户的主目录中吗? (它实际上在哪里?它的确切路径是什么?)。 ssh git@ganesh 显示什么?
  • @VonC:感谢您的回复。我重新安装了 gitolite,看来我可以使用命令 git clone gitolite:testing.git 在我的工作站 PC 上克隆 testing.git。它工作正常。我也能够毫无问题地提交和推送原始主机。但是当我尝试使用命令git clone git@ganesh:testing.git 在我的服务器上做同样的事情时,它给出的'testing.git' 似乎不是一个git 存储库。我还在 git 用户的 authorized_keys 文件中添加了管理员用户的 ssh 密钥。
【解决方案2】:

http://sitaramc.github.com/gitolite/doc/ssh-troubleshooting.html(以及 gitolite 源代码库中的)的 ssh 故障排除文档现在已完全重新编写。我希望它能够更好地流动并且更容易解释事情,包括这个特定的错误。

我还要补充一点,理想情况下,您应该完整阅读该文档,至少是第一次阅读。

西塔拉姆

【讨论】:

【解决方案3】:

刚刚遇到同样的错误。

正确答案是您需要使用git clone gitolite:repo_name 命令来克隆存储库并使用git push gitolite:repo_name 来推送更改,而不是使用git clone git@yourservername:repo_name

【讨论】:

  • @simont:请注意,** 粗体在代码格式中不起作用。 (它可能是双指针间接或求幂,或者显示如何在 Markdown 中加粗内容...)
  • @sarnold 我没想到 - 注意到了。
【解决方案4】:

尝试:

ssh git@ganesh

你应该看到 gitolite-shell 而不是 bash:

ssh git@localhost

PTY allocation request failed on channel 0 hello
id_rsa, the gitolite version here is 2.0.3-2 (Debian) the gitolite
config gives you the following access:
     R   W  gitolite-admin
    @R_ @W_ testing
Connection to localhost closed.

如果不是,则意味着您绕过 gitolite-shell 并改用 bash。 原因可能是,通过运行 gl-setup your_pub_key.pub 您将密钥添加到 /home/git/.ssh/authorized_keys 文件的底部。

因此,永远不会到达此键,因为顶部还有其他键。因此,您只需打开 /home/git/.ssh/authorired_keys 并将最近添加的 gitolite 密钥移动到文件顶部即可。

将此记录移至文件顶部后,您应该可以使用: git clone git@ganesh:testing.git 而不是 git clone git@ganesh:repositories/testing.git 第二个克隆 repo 但导致错误,因为您通过 bash 而不是 gitolite-shell 运行“git push”

【讨论】:

    猜你喜欢
    • 2012-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-16
    • 1970-01-01
    相关资源
    最近更新 更多