GitLab git user password

前端 未结 19 1214
借酒劲吻你
借酒劲吻你 2020-12-02 22:10

I have just installed GitLab.

I created a project called project-x.

I have created few users and assigned it to the project.

Now I tried to clone:

相关标签:
19条回答
  • 2020-12-02 22:28

    This can happen if the host has a '-' in its name. (Even though this is legal according to RFC 952.) (Tested using Git Bash under Windows 10 using git 2.13.2.)

    ssh prompts me for a password for any host that happens to have a '-' in its name. This would seem to be purely a problem with ssh configuration file parsing because adding an alias to ~/.ssh/config (and using that alias in my git remote urls) resolved the problem.

    In other words try putting something like the following in your C:/Users/{username}/.ssh/config

    Host {a}
        User git
        Hostname {a-b.domain}
        IdentityFile C:/Users/{username}/.ssh/id_rsa
    

    and where you have a remote of the form

    origin  git@a-b.domain:repo-name.git
    

    change the url to use the following the form

    git remote set-url origin git@a:repo-name.git
    
    0 讨论(0)
  • 2020-12-02 22:29

    The Solution from https://github.com/gitlabhq/gitlab-shell/issues/46 worked for me.

    By setting the permissions:

    chmod 700 /home/git/.ssh
    chmod 600 /home/git/.ssh/authorized_keys
    

    password prompt disappears.

    0 讨论(0)
  • 2020-12-02 22:30

    In my case, I was using a pair of keys that didn't have the default names id_rsa and id_rsa.pub.

    Producing keys with these names solved the problem, and I actually found it looking at the output of ssh -vT my_gitlab_address. Strange fact: it worked on one computer with Ubuntu, but not on others with different distributions and older versions of OpenSSH.

    0 讨论(0)
  • 2020-12-02 22:30

    To add yet another reason to the list ... in my case I found this problem was being caused by an SELinux permissions problem on the server. This is worth checking if your server is running Fedora / CentOS / Red Hat. To test this scenario you can run:

    Client: ssh -vT git@<gitlab-server> -- asks for password
    Server: sudo setenforce 0
    Client: ssh -vT git@<gitlab-server> -- succeeds
    Server: sudo setenforce 1

    In my case the gitlab/git user's authorized_keys file had the wrong SELinux file context, and the ssh service was being denied permission to read it. I fixed this on the server side as follows:

    sudo semanage fcontext -a -t ssh_home_t /gitlab/.ssh/
    sudo semanage fcontext -a -t ssh_home_t /gitlab/.ssh/authorized_keys
    sudo restorecon -F -Rv /gitlab/.ssh/
    

    And I was then able to git clone on the client side as expected.

    0 讨论(0)
  • 2020-12-02 22:31

    I had the right public/private key, but seemed like it didn't work anyway (got same errors, prompting for the git-user password). After a computer-restart it worked though!

    0 讨论(0)
  • 2020-12-02 22:33

    On Windows 10 using the terminal under VS Code I got a prompt for "git@gitlab's password:" when trying to:

    git push -u origin --all
    

    I had established my ssh credentials in windows and in gitlab but I had used Windows 10 bash key-gen to do so. The solution then was to invoke bash in VS code terminal and then issue the command again.

    bash
    git push -u origin --all
    

    It succeeded.

    To avoid having to use bash/git manually, I then put a symlink between the windows .ssh/id_rsa and the bash shell .ssh/id_rsa:

    C:\Users\bruce\.ssh>mklink id_rsa C:\Users\bruce\AppData\Local\lxss\home\bruce\.ssh\id_rsa
    

    VS Code Git menu actions (push, pull, etc.) now worked with gitlab

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