Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Added SSH key to Gitlab but it still asks for my credentials

GitLab's HTTP pull & push are working when I enter my credentials.

But when using an added SSH key, it is always is asking for my password, which I don't know. Why is GitLab doing this? Is it a server fault?

And when calling ssh -vT [email protected] there is an error:

Permission denied (publickey)

I've tried everything, even re-installing Git, but nothing works. Even their own solution is not working, as described here: https://help.github.com/articles/error-permission-denied-publickey/

like image 753
Jānis Blaus Avatar asked Mar 15 '15 13:03

Jānis Blaus


2 Answers

I had the same issue, after checking

/var/log/auth.log

I got :

*User git not allowed because account is locked
*input_userauth_request: invalid user git [preauth]
*Connection closed by IP.IP.IP.IP [preauth]

So the fix was

sudo passwd -d git

Thanks to Noah (source)

like image 165
emonik Avatar answered Nov 14 '22 08:11

emonik


I had similiar problem with new installation of gitlab. After some investigation I've seen below message shown in systemctl status sshd:

Accepted publickey for git from 10.x.x.x port 50858 ssh2: RSA 67:01:..

User git from 10.x.x.x not allowed because none of user's groups are listed in AllowGroups

Adding git user into sshusers group solve my problem.
Hope this helps

like image 26
serdroid Avatar answered Nov 14 '22 08:11

serdroid