【问题标题】:Gitolite with LDAP not workingGitolite 与 LDAP 不工作
【发布时间】:2013-08-02 03:50:58
【问题描述】:

我是 gitolite 的新手。我正在尝试用 gitolite 做一个非常简单的测试。我已经设置了名为“test_repo”的存储库。请注意,除了我在下面说明的内容之外,我没有修改任何其他内容。我可以在 gitweb 中看到这个 repo。这是repo配置

repo test_repo
    RW+     =   @all

现在我想克隆这个 repo。我有对服务器的 ldap 访问权限。根据我对@all 的理解,它应该允许我这样做。

当我发布时

git clone git@myserver:repositories/test_repo.git 
#I know this is wrong. But I just wanted to test as the above did not work

git clone git@myserver:test_repo.git

它要求输入密码。我遵循了这个指南http://sharadchhetri.com/2013/05/31/how-to-create-own-git-server-with-gitolite-and-gitweb-in-ubuntu/,它没有为git用户设置密码

当我发布时

git clone myname@myserver:test_repo.git

我收到以下错误

fatal: 'test_repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我也厌倦了克隆默认存储库“test_repo.git”。但我遇到了同样的错误。

这个我也累了

git clone myname@myserver:/home/git/repositories/testing.git

然后克隆正在工作。但是当我做git push -u origin master 一些修改过的文件时,我得到了

error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
! [remote rejected] master -> master (n/a (unpacker error))

注意:我没有在conf文件中添加任何用户

感谢任何帮助。

【问题讨论】:

    标签: git ldap gitolite


    【解决方案1】:

    试试看

    ssh git@hostname-or-ip

    这不应该问密码;它可以询问密码。这还将发出您有权访问的存储库列表。

    顺便说一句 - git clone 命令中的用户名@localhost 严重错误

    【讨论】:

    • 我累了ssh git@ip。它要求输入密码
    • 奇怪的是,如果我执行 ssh git@localhost 它会显示您的建议
    • 那么你的克隆网址应该是“git clone user@hostname:repo.git”
    • 另一件事 - ip 和名称之间可能不匹配。尝试清理 /etc/hosts。使用正确的 dns 服务器等..等;检查 ~/.ssh/config 文件。可能粘贴在stackoverflow上
    • git clone myname@myserver:test_repo.git 不工作。这个输出在帖子中更新
    【解决方案2】:
     git clone myname@myserver:/home/git/repositories/testing.git
    
    • 完全绕过不叫的gitolite
    • 使用了错误的帐户“myname”,它无权读取 git 帐户文件夹。

    应该起作用的是:

     git clone git@myserver:test_repo.git
     or
     git clone git@myserver/test_repo.git
    

    你不应该指定'repositories'文件夹(gitolite知道repo应该在哪里)

    假设ssh -Tvvv git@myserver 有效(即不询问密码)。
    先让 ssh 工作,然后再试一次 git clone


    正如我在评论中所说,LDAP ssh 都是身份验证机制,因此您可以使用一个或另一个,而不是两者

    如果 ssh 有效,但克隆无效,那么您需要查看 ~git/.gitolite/logs 的 gitolite 日志

    我在日志中找不到任何有用的信息。此外,我做了一个tail -f 的日志文件。当我尝试克隆时,它甚至没有更新。

    这意味着问题出在 ssh 级别,没有正确调用 gitolite:在 ~git/.ssh/authorized_keys 中,如果您直接在其中手动添加 ssh 密钥,而不是通过gitolite-admin repo 的keys 文件夹添加并将该repo 推回gitolite 服务器(这会触发所述~git/.ssh/authorized_keys file 的更新)。

    我认为这可能是原因。我不知道刚刚发生了什么。我什至可以在管理服务器中克隆gitolite-admin(这在早期工作)。
    我会重新安装所有东西(因为我觉得我现在把配置文件搞砸了)。

    【讨论】:

    • ssh -Tvvv git@myserver 要求输入密码
    • 请注意,我尝试登录的客户端不是管理系统。另外我还没有添加这个系统的密钥。
    • 我不想添加 ssh,因为这意味着每个人都必须这样做。我希望 ldap 进行身份验证
    • 为了测试,我添加了键。所以ssh git@myserver 正在工作。但是当我使用 : 时,它会显示与以前相同的错误。当我使用 \ 它显示fatal repository does not exist
    • @knightrider 您可以使用 apache + LDAP (+ gitolite),正如我在 stackoverflow.com/a/17985744/6309 中所说明的那样,或者 ssh + gitolite。但不是 ssh + LDAP + gitolite。 ssh 进行身份验证。或者 LDAP 进行身份验证。不是都。因此,当使用 ssh url 克隆 repo 时,您始终使用“git”,而不是“user”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 2012-05-02
    • 2022-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多