Gitlab prompts for password while push for git user

前端 未结 8 1085
遇见更好的自我
遇见更好的自我 2020-12-24 06:55

I installed gitlab on my servers at linode. All services of gitlab are working fantastic. I am able to login, create users, repos etc. But the problem I am facing is when I

相关标签:
8条回答
  • 2020-12-24 07:16

    On systems with SELinux enabled you should not disable SELinux as suggested in some answers.

    To get along with the SELinux restrictions (iff they are the reason for the password prompt; check your /var/log/audit/audit.log ) change the security context for gitlab:

    chcon -t user_home_dir_t /var/opt/gitlab/
    chcon -t ssh_home_t /var/opt/gitlab/.ssh/
    chcon -t ssh_home_t /var/opt/gitlab/.ssh/authorized_keys
    

    (as suggested at the gitlab group)

    0 讨论(0)
  • 2020-12-24 07:16

    To properly fix the selinux issues, use the following. Note that chcon is only temporary and will not survive a relabel or restorecon, so you should use semanage instead.

    semanage fcontext -a -t user_home_dir_t "/var/opt/gitlab(/.*)?"
    semanage fcontext -a -t ssh_home_t "/var/opt/gitlab/.ssh(/.*)?"
    restorecon -rv /var/opt/gitlab
    
    0 讨论(0)
  • 2020-12-24 07:17

    In my case, I had to add the remote repository with ssh as

    git remote add gitlab ssh://git@your.project:222/git/repo_name.git 
    

    which made git not request me the password again. Note the use of ssh:// and port=222.

    0 讨论(0)
  • 2020-12-24 07:19

    I had a similar problem when I set the remote repository with the HTTP URL.

    I changed it to use the SSH URL, and it worked fine:

    git remote set-url gitlab git@gitlab.devekko.net:niccolox/cirm-website.git
    
    0 讨论(0)
  • 2020-12-24 07:27

    I had the same problem but it was because my server only accept ssh login from users of "sshusers".

    On /etc/ssh/sshd_config I had the following line :

    AllowGroups sshusers
    

    In order to fix this issue, I added git to sshusers group:

    $ sudo adduser git sshusers 
    

    And then it's working.

    0 讨论(0)
  • 2020-12-24 07:31

    I tried many options but no success. The only that resolved for me was osxkeychain helper

    See the tutorial here.

    The tutorial is from github, but works great for gitlab too.

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