Can't clone gitlab's repo via ssh, via http - OK

前端 未结 1 1263
臣服心动
臣服心动 2020-12-14 09:46

I\'m new to gitlab and CI so i had tons of questions but some of them solved via google, SO, git mans, but not the last ...

I can\'t clone repo via ssh =(

If

相关标签:
1条回答
  • 2020-12-14 10:34

    GitLab 5.x doesn't use gitolite anymore, but gitlab-shell.

    I would advise to create a dedicated account, as recommended in the installation process.

    ssh git@gitlab.vbox
    

    That ssh commands means you are asking for a secure shell on 'gitlab.vbox' as user 'git'. If that user doesn't exist... it won't work.

    There is no need to try and clone repo is the tests doesn't run properly:

    sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
    

    The OP reports ssh works better after creating the git user and adding the keys, but:

    • first make sure you create your keys on a 'client' account', not in ~git/.ssh/id_rsa: you are trying to open a session as git, from a client account. git is the account in which gitlab is installed.
    • You should then register your public key in the ssh page of the user account you declare through the gitlab gui. You should not "useradd" an ssh to root.

    If you see this:

    lesha@lesha-SeoTeam:/var/www$ git clone git@gitlab.vbox:root/virtualboxgitlab.git
    Cloning into 'virtualboxgitlab'...
    fatal: 'root/virtualboxgitlab.git' does not appear to be a git repository
    fatal: The remote end hung up unexpectedly
    

    That also means you shouldn't specify the path of the repo (root/):

     git clone git@gitlab.vbox:virtualboxgitlab.git
    

    It is gitlab job to know where virtualboxgitlab.git is stored (as specified in its gitlab.yml config file)

    Basically, forget root, and do the full installation of gitlab as it was intended: in a 'git' account.

    The OP made it work, commenting that:

    "root" is administrators namespace, gitlab creates this url automatically and without it clone doesn't work, now everything clones and I begin to install gitlab CI,

    The OP had to:

    add my user to sudo group, made clean install, received error

    /usr/local/lib/ruby/2.0.0/net/http.rb:878:in initialize': getaddrinfo: 
      Name or service not known (SocketError)
    

    which can't resolve hostname, added gitlab.vbox to /etc/hosts

    0 讨论(0)
提交回复
热议问题