【问题标题】:Cannot access gitolite repos with non-gitolite admin users无法使用非 gitolite 管理员用户访问 gitolite 存储库
【发布时间】:2013-11-22 15:34:39
【问题描述】:

我在 Ubuntu 12.04 上安装了 Gitolite 3.5.3。我创建了测试存储库,我只能通过 gitolite 用户而不是其他用户通过 ssh 访问它。 我需要允许通过 ssh 访问其他系统用户(user1、user、user2)或用户组到 git(push、pull merge 等),如下所示:

git clone user1@domain.com:megaproject

但我尝试这样连接:

git clone user@domain.com:megaproject

并为我得到的这个用户写下正确的密码:

fatal: 'megaproject' 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.

即使我使用我的 ssh 公钥在 gitolite 用户的主文件夹中创建 keydir 目录 - 也没有任何变化。

我应该更改哪些内容才能以这种方式提供访问权限?

【问题讨论】:

    标签: git ssh repository gitolite


    【解决方案1】:

    您永远不会使用“用户”克隆/访问 gitolite 管理的存储库。
    您始终使用安装 gitolite 时使用的“git”帐户。

    然后,Gitolite 将通过在 ~git/.ssh/authorized_keys file 中查找用于此调用的公钥来推断您的实际身份。

    在“How do programs like gitolite work?”查看更多信息。


    如果您想以不同的用户身份访问 gitolite 管理的存储库,您需要为这些用户拥有正确的公钥/私钥,并在 ~/.ssh/config 文件中引用私钥,如“ users are asked for password while using gitolite"。

    Host gitolite_as_user1
        HostName gitolite_server_name
        User git
        IdentityFile ~/.ssh/user1
    
    Host gitolite_as_user2
        HostName gitolite_server_name 
        User git
        IdentityFile ~/.ssh/user2
    

    请注意,ssh url 将是:

    ssh://gitolite_as_user1:yourRepo
    ssh://gitolite_as_user2:yourRepo
    

    它会一直使用 'git' 帐户(但使用不同的公共 ssh 密钥)

    【讨论】:

    • 我怎样才能给其他用户访问权限?
    • @user1858864 您需要将他们的公钥添加到 gitolite 服务器:请参阅 gitolite.com/gitolite/users.html
    猜你喜欢
    • 2013-05-04
    • 1970-01-01
    • 2014-10-20
    • 2011-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多