本文介绍了gitolite:可以通过ssh连接,无法克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的服务器上安装了gitolite。这属于非根方法。



当我尝试将gitolite-admin克隆回客户端时,它失败。我收到以下错误消息:

  git clone [email protected]:gitolite-admin 
克隆到gitolite-admin ...
致命:远程终端意外挂起

另外:



$ p $ g $ git clone ssh:用户名git-upload-pack'gitolite。
致命:远程终端意外挂起

我也尝试追加 .git 到repo名称的末尾,我也尝试添加 repositories / gitolite-admin 上面链接的教程)以及这两者的组合并且都不起作用。我可以在Google上找到关于使用用户名位的结果,这让我非常喜欢。



我可以通过ssh连接到机器,它告诉我我有访问R和W gitolite-admin 。那么,SSH是否正在工作?

解决方案

检查ssh :您可以连接到 server.com ssh 只表示:


  • 您的ssh密钥在 server.com@~/.ssh/authorized_keys

  • 该键与gitolite无关没有 command = 选项,这意味着无论传入用户要求做什么,都强行运行该命令)。
    您处于交互式会话中,能够执行任何您喜欢的命令。



对于第三方教程,我不太喜欢的是它会尝试对git user和ssh non-root用户使用相同的名称


$ b 您应该保持分开


  • 非root用户不是帐户),只是一个ssh密钥,它将被链接到gitolite,并具有管理权限给 gitolite-admin 回购)

  • 托管帐户,这应该是 git ',而不是 gitolite ,正好避免混淆两种使用模式之间

    • git 直接登录到 server.com ,这里没有ssh ):执行git命令所需的交互式会话(如在服务器上克隆gitolite repo,并执行 gitolite / src / gl-system-install

    • ssh [email protected] c $ c>〜/ .ssh / id_rsa(.pub)公钥和私钥,作为gitolite的一部分,它将授权你克隆 gitolite-admin



    再次提示:

    'gitolite'不是真正的帐户,只有授权执行 se>命令的名称rver.com 为' git '(实际的托管帐户,如托管git服务和回购)。

    所有其他的git用户也会在 server.com 中执行git命令作为 git

    那个特定用户( gitolite )将通过,并在gitolite安装期间设置权限,以授予'用户'克隆,修改和推回<$ c
    (这是它唯一的特殊性,与所有其他的ssh git用户相比,你将添加:他们将无法访问到那个特定的git仓库,这是 gitolite-admin 一个)



    试着用相同的名字命名这两个仓库只是要求麻烦。



    我不喜欢使用公共/私人的默认命名约定键,所以我更喜欢在客户端上定义那些具有用户名称的键:

     〜/ .ssh / gitolite。 pub 
    〜/ .ssh / gitolite

    然后我定义一个配置文件: with:

      host gitolite 
    用户git
    主机名server.com
    身份文件〜/ .ssh / gitolite

    (注意这里的用户:总是 git

    然后我可以克隆我的 gitolite-amin repo:
    $ b $ pre $ g $ git clone gitolite gitolite-admin
    #在本地修改
    #git add -A; git commit -mmy modifs
    git push origin master


    I installed gitolite on my server using this tutorial. This falls under the "non-root" method.

    It fails when I try to clone gitolite-admin back to my client. I get this error message:

    git clone [email protected]:gitolite-admin
    Cloning into gitolite-admin...
    fatal: The remote end hung up unexpectedly
    

    Also:

    git clone ssh://[email protected]:gitolite-admin
    Cloning into gitolite0admin...
    Using username "git-upload-pack 'gitolite".
    fatal: The remote end hung up unexpectedly
    

    I have also tried appending .git to the end of the repo name, and I have also tried adding repositories/gitolite-admin (suggested by the errors in the tutorial linked above) and a combination of both of these and none work. I can find no results on google regarding the "Using username" bit, which intrigues me.

    I can connect to the machine via ssh, and it tells me that I have access to R and W gitolite-admin. So, SSH is working?

    解决方案

    Check the ssh parts about gitolite: the fact that you can connect to server.com through ssh only means:

    • your ssh key is registered in server.com@~/.ssh/authorized_keys
    • that key isn't related to gitolite 'there is no "command=" option, which means "regardless of what the incoming user is asking to do, forcibly run this command instead").
      You are in an interactive session, able to execute any command you like.

    What I don't like at all about the third-party tutorial is that it tries using the same name for git user and ssh non-root user

    You should keep separate:

    • the non-root user (which isn't an account, just an ssh key, which will be linked to gitolite, with admin privileges to the gitolite-admin repo)
    • the hosting account, which should be 'git', not gitolite, precisely to avoid confusion between the two usage mode:
      • git (log on directly on server.com, no ssh here): interactive session needed to execute git command (like cloning on the server the gitolite repo, and executing gitolite/src/gl-system-install)
      • ssh [email protected] which will use your ~/.ssh/id_rsa(.pub) public and private keys, which, being the ones of the gitolite, will authorize you to clone the gitolite-admin repo and push back that repo

    Again:
    'gitolite' is not a true account, only a name authorized to execute commands on server.com as 'git' (the actual "hosting account", as in "hosting git services and repos").
    All the other git users will also execute git commands on server.com as git.
    And that particular user (gitolite) will be linked to gitolite authorization layer through the forced-command mechanism, with privileges setup during the gitolite installation in order to grant that 'user' rights to clone, modify and push back gitolite-admin repo.
    (That is its only particularity compared to all the other ssh git users you will add: they won't have access to that specific git repo which is the gitolite-admin one)

    Trying to name the two with the same name is just asking for trouble.

    I don't like using the default naming convention for the public/private keys, so I prefer on the client defining those keys with the name of the intended user:

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

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

    host gitolite
         user git
         hostname server.com
         identityfile ~/.ssh/gitolite
    

    (Note the user here: always git)
    Then I can clone my gitolite-amin repo:

    git clone gitolite:gitolite-admin
    # modify locally
    # git add -A ; git commit -m "my modifs"
    git push origin master
    

    这篇关于gitolite:可以通过ssh连接,无法克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 12:38