gitolite推送错误->远程:ENV GL_RC 未设置

发布于 2024-10-21 00:06:48 字数 685 浏览 5 评论 0原文

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

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。

I am trying to push content from a workstation to a server. But it gives me an error. Please look at the following for command and error:

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'  

It seems that I need to set the environment variable GL_RC. Is this so?

Can anyone here tell me what the problem might be and how I can solve it? I am using gitolite on Windows Server 2003.

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

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

发布评论

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

评论(4

轻许诺言 2024-10-28 00:06:48

如文档 ssh 故障排除 中所示,这可能是由于克隆期间路径不正确导致的。

文档(下面的某些部分仅对 Gitolite V2 有效)提到:

第二个错误

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

如果您使用git@server:repositories/reponame.git(假设默认的$REPO_BASE设置——在Gitolite V3,它始终是 ~/repositories) -- 即 < strong>您使用了完整的 UNIX 路径。
由于不需要上面提到的“前缀”,因此 shell 可以正常找到存储库并克隆。
但是当你推送时,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

As illustrated in the doc ssh troubleshooting, this is probably caused by an incorrect path during cloning.

The documentation (some parts below were only valid for Gitolite V2) mentions:

The second error

(ie. "you are able to clone repositories but are unable to push changes back (the error complains about the GL_RC environment variable not being set, and the hooks/update failing in some way)

happens if you use git@server:repositories/reponame.git (assuming default $REPO_BASE setting -- in Gitolite V3, it always is ~/repositories) -- that is, you used the full unix path.
Since the "prefixing" mentioned above is not required, the shell finds the repo and clones ok.
But when you push, gitolite's update hook kicks in, and fails to run because some of the environment variables it is expecting are not present.

The message that appears on a successful run of the "easy-install" program clearly includes the following warning:

*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

So in your case, you must have cloned your repo with:

git clone git@ganesh:repositories/testing.git

instead of:

git@ganesh:testing.git
烛影斜 2024-10-28 00:06:48

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

我还要补充一点,您最好应该完整阅读该文档,至少是第一次。

西塔拉姆

The ssh troubleshooting document at http://sitaramc.github.com/gitolite/doc/ssh-troubleshooting.html (as well as in the gitolite source repo) has been totally re-worked now. I'm hoping that it flows much better and explains things easier, including this specific error.

I'll also add that you should ideally read that document in full, at least the first time.

Sitaram

煮茶煮酒煮时光 2024-10-28 00:06:48

刚刚遇到同样的错误。

正确的答案是您需要使用 git clone gitolite:repo_name 命令来克隆存储库并使用 git push gitolite:repo_name 来推送更改,而不是使用 git clone git@你的服务器名称:repo_name。

Just got the same error.

Correct answer is you need to use git clone gitolite:repo_name command to clone the repository and git push gitolite:repo_name to push changes, instead of git clone git@yourservername:repo_name.

爱给你人给你 2024-10-28 00:06:48

尝试:

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 克隆 git@ganesh:testing.git
代替
git 克隆 git@ganesh:repositories/testing.git
第二个克隆了存储库,但导致错误,因为您通过 bash 而不是 gitolite-shell 运行“git Push”

Try to:

ssh git@ganesh

You should see gitolite-shell instead of 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.

If not it means you bypass gitolite-shell and use bash instead.
The reason might be, that by running gl-setup your_pub_key.pub you added your key to the bottom of /home/git/.ssh/authorized_keys file.

Therefore, this key is never reached, because there are other keys at the top. So, you simply need to open /home/git/.ssh/authorired_keys and move the recently added gitolite key to the top of the file.

After moving this record to the top of the file, you should be able to use:
git clone git@ganesh:testing.git
insead of
git clone git@ganesh:repositories/testing.git
The second one clones the repo but leads to the error, because you run "git push" via bash instead of gitolite-shell

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