2011-03-08 151 views
10

我试图将内容从工作站推送到服务器。但它给了我一个错误。请看看在命令和错误如下:gitolite推送错误 - >远程:ENV GL_RC未设置

[email protected] ~/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 [email protected]:repositories/testing 
! [remote rejected] master -> master (hook declined) 
error: failed to push some refs to '[email protected]:repositories/testing' 

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

任何人都可以告诉我这个问题可能是什么,我该如何解决它?我在Windows Server 2003上使用gitolite。

+1

它的前缀为'remote:',这意味着gitolite更新挂钩会打印该错误。看起来gitolite没有在存储库中正确配置。 – 2011-03-08 13:42:12

+0

如何找到问题?我没有得到确切的结果。我应该重新安装gitolite吗? – amar4kintu 2011-03-08 13:56:17

回答

9

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

的文档(以下某些部分仅适用于Gitolite V2)中提到:

The second error

(即“你能克隆库,但无法更改推回(错误埋怨GL_RC环境变量未设置,以及钩/更新以某种方式失败)

happens if you use [email protected]: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.

,关于“易安装”,明确项目的成功运行将出现消息包括以下警告:

*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 [email protected]:repositories/testing.git 

[email protected]:testing.git 
+3

@VonC:谢谢你的回答。你对我所做的事情是对的。但是当我尝试使用'git clone git @ ganesh:tests.git'来克隆存储库时,它给**'tests.git似乎不是git存储库'**我没有得到确切的错误,或者我该如何纠正它。你能给我一些建议吗?谢谢 – amar4kintu 2011-03-09 05:07:03

+0

@ amar4kintu:可以肯定的是,'git clone git @ ganesh:testing'会返回什么? (所以,克隆没有最后的'.git'')。 – VonC 2011-03-09 05:11:47

+1

@VonC:再次感谢您的回复。它返回相同的错误**'测试'似乎不是一个混帐存储库** – amar4kintu 2011-03-09 05:39:47

2

刚刚得到了同样的错误。

正确的答案是您需要使用git clone gitolite:repo_name命令克隆存储库,git push gitolite:repo_name推送更改,而不是git clone [email protected]:repo_name

+0

@simont:注意'**'粗体在代码格式中不起作用。 (它可能是双指针间接或指数,或者显示如何在减价中加粗内容,毕竟......) – sarnold 2012-02-18 00:40:32

+0

@sarnold我没有想到 - 注意到了。 – simont 2012-02-18 00:51:04

2

http://sitaramc.github.com/gitolite/doc/ssh-troubleshooting.html(以及在gitolite源回购)的ssh故障排除文档现在已经完全重新工作。我希望它流动得更好,解释更简单,包括这个特定的错误。

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

Sitaram

+0

指向SSH故障排除文档的链接现在是http://sitaramc.github.com/gitolite/sts.html – appas 2012-01-09 08:44:41

2

尝试:

ssh [email protected] 

你应该看到gitolite壳代替的bash:

ssh [email protected] 

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壳和使用bash来代替。 原因可能是,通过运行gl-setup your_pub_key.pub,您将密钥添加到/home/git/.ssh/authorized_keys文件的底部。

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

此记录移动到文件的顶部后,你应该能够使用: 混帐混帐克隆加尼甚@:仓库/ testing.git 第二:testing.git INSEAD 混帐混帐克隆@ Ganesh神的一个克隆回购,但导致错误,因为你通过bash而不是gitolite-shell运行“git push”