git clone git@myserver:gitolite-admin 失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12617672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:40:52  来源:igfitidea点击:

git clone git@myserver:gitolite-admin fails

gitgitolite

提问by macbert

I am trying to get an git server repository running. I did install gitolite

我正在尝试运行 git 服务器存储库。我确实安装了 gitolite

when running git info over ssh the server answers

通过 ssh 运行 git info 时,服务器会回答

ssh git@myserver info

hello Brian, this is git@hepide01pep1 running gitolite3  on git 1.6.3.2
R W   testing

When trying to clone the gitolite-admin repository I get the following error

尝试克隆 gitolite-admin 存储库时,出现以下错误

git clone git@myserver:gitolite-admin

Cloning into 'gitolite-admin'...
FATAL: R any gitolite-admin Brian DENIED by fallthru
(or you mis-spelled the reponame)
fatal: The remote end hung up unexpectedly

Same thing happens with this syntax

这种语法也会发生同样的事情

git clone ssh://git@myserver/gitolite-admin 
Cloning into 'gitolite-admin'...
FATAL: R any gitolite-admin Brian DENIED by fallthru
(or you mis-spelled the reponame)
fatal: The remote end hung up unexpectedly

Cann anybody give me some useful hints? I checked the Answers here and on the web but didn't find anything that helped me any further.

有人能给我一些有用的提示吗?我在这里和网上检查了答案,但没有找到任何进一步帮助我的东西。

回答by MrOodles

The accepted answer is a good one if you you're just setting up gitolite, but if you're a new user to an existing installation, you'll get the same error as the one in the question unless you've been added as an administrator.

如果您只是设置 gitolite,接受的答案是一个很好的答案,但如果您是现有安装的新用户,除非您已被添加为管理员。

If you have shell access to the server gitolite lives on, login and switch to the user that gitolite users - usually called git.

如果您拥有对 gitolite 所在服务器的 shell 访问权限,请登录并切换到 gitolite 用户所在的用户 - 通常称为git.

Once logged into the gitolite user, go to the conf file and give yourself RW+ rights on the gitolite-admin repo. Gitolite conf is usually in /home/git/.gitolite/conf/gitolite.conf(assuming username is git). For a gitolite user named Peaches, grant the permissions thusly:

登录到 gitolite 用户后,转到 conf 文件并在 gitolite-admin 存储库上授予自己 RW+ 权限。Gitolite conf 通常在/home/git/.gitolite/conf/gitolite.conf(假设用户名是git)。对于名为 的 gitolite 用户Peaches,授予权限:

repo gitolite-admin
    RW+     =   OriginalAdmin Peaches

Save the file, and run setup from the command line, still as the gitolite user:

保存文件,并从命令行运行 setup,仍然是 gitolite 用户:

gitolite setup

If you've been setup as a user correctly, you should be able to clone now.

如果您已正确设置为用户,则现在应该可以进行克隆。

For more on adding users, see the documentation

有关添加用户的更多信息,请参阅文档

回答by VonC

gitolite-adminis only accessible with the public key named after the git account used for the gitolite server.

gitolite-admin只能使用以用于 gitolite 服务器的 git 帐户命名的公钥访问。

You are using by default your brian.pub, which only gives you access to testing.gitrepo.

默认情况下brian.pub,您使用的是 your ,它只能让您访问testing.gitrepo。

you need to define a $HOME/.ssh/configfile on your local workstation, in order to record ssh parameters to use the right key.
See "gitolite: can connect via ssh, can't clone".

您需要$HOME/.ssh/config在本地工作站上定义一个文件,以便记录 ssh 参数以使用正确的密钥。
请参阅“ gitolite:可以通过 ssh 连接,无法克隆”。

~/.ssh/gitolite.pub
~/.ssh/gitolite

Then I define a config file: ~/.ssh/config with in it:

然后我定义了一个配置文件: ~/.ssh/config ,其中包含:

host gitolite
     user git # replace it by the actual git user for the gitolite server
     hostname server.com
     identityfile ~/.ssh/gitolite

The clone will work:

克隆将工作:

git clone gitolite:gitolite-admin


The OP macbertconfirms:

OP macbert确认:

I did rename the key to git.pub, ran gitolite setup -pk git.puband removed the old briankey from the .gitolite/keydir.
After that I got git clone git@myserver:gitolite-admin:

我确实将密钥重命名为git.pub,运行gitolite setup -pk git.pubbrian.gitolite/keydir.
之后我得到git clone git@myserver:gitolite-admin

Cloning into 'gitolite-admin'... 
remote: Counting objects: 15, done. 
remote: Compressing objects: 100% (12/12), done. 
remote: Total 15 (delta 0), reused 0 (delta 0) 
Receiving objects: 100% (15/15), done.

So with the right default key, a ssh git@myserver infoshould this time display the right access for gitolite-adminrepo in the 'hello' message.

因此,使用正确的默认密钥,ssh git@myserver info这次应该gitolite-admin在“hello”消息中显示对repo的正确访问权限。

回答by iltempo

Usually bare git repos are using a .gitname. Please try to do

通常裸 git 存储库使用.git名称。请尝试做

git clone git@myserver:gitolite-admin.git

git clone git@myserver:gitolite-admin.git