Why does ssh connection to gitlab not work (while http push and clone work fine)?

前端 未结 4 2404
野的像风
野的像风 2021-02-20 11:48

I run a x86 raring ringtail on a old pc and having installed bitnami gitlab 5.3.

Here is my error msg when trying to push the first master branch in SSH mode:

         


        
相关标签:
4条回答
  • 2021-02-20 12:14

    I've got the following error trying to clone repo via ssh from freshly installed gitlab:

    fatal: Could not read from remote repository.

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

    Solution was found at https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#ssh

    Check ssh log /var/log/auth.log and if you find error:

    User git not allowed because account is locked
    

    then edit /etc/shadow and change git:!: to git:*:

    P.S. In my case on CentOS 6.5 it was /var/log/secure and git:!!:

    0 讨论(0)
  • 2021-02-20 12:15

    I had a same error. searched and tried many way. It didn't work. Then, i found the answer in this site [http://georgik.sinusgear.com1. It worked for me.

    My gitlab's version is 6.6.4.

    Do as below:

    1. find port unicorn run on:

      sudo emacs /home/git/gitlab/config/unicorn.rb

    scroll to # listen on both a Unix domain socket and a TCP port and found that: listen "127.0.0.1:port", :tcp_nopush => true

    1. edit config.yml

      sudo emacs /home/git/gitlab-shell/config.yml

    change gitlab_url: "your-domain"

    to

    gitlab_url: "127.0.0.1:[port]"

    restart gitlab

    sudo service gitlab stop

    sudo service gitlab start

    0 讨论(0)
  • 2021-02-20 12:31

    I needed to add my public key to the /home/git/repositories/.ssh/authorized_keys. The authoried_keys in /home/git/.ssh seems to not be used.

    1. Add your public key to authorized_keys

      cat id_rsa.pub >> /home/git/repositories/.ssh/authorized_keys
      
    2. Ensure git is the owner of the file

      chown git /home/git/repositories/.ssh/authorized_keys
      
    3. Ensure group is git

      chgrp git /home/git/repositories/.ssh/authorized_keys
      
    4. Set file mode bits

      chmod 600 /home/git/repositories/.ssh/authorized_keys
      
    0 讨论(0)
  • 2021-02-20 12:34

    Check the permissions on the .ssh folder.

    Login as the git user and set with

    sudo su - git
    chmod 700 ~/.ssh
    chmod 600 ~/authorized_keys
    

    If still having issues use the verbose output from ssh to gain more info

    ssh -v  ssh -T git@my-server.com
    

    (Also it could be a selinux context issue if selinux is enabled and enforcing, see this blog)

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