开发者

Gitlab SSH Key | must the ssh have the same username as gitlab account

开发者 https://www.devze.com 2022-12-07 17:17 出处:网络
Problem Does the \'user@host\' of the id_rsa.pub need to match with the actual machine username - hostand then with theusername in Gitlab?

Problem

Does the 'user@host' of the id_rsa.pub need to match with the actual machine username - host and then with the username in Gitlab?

Example:

  • Gitlab username name: @john.doe
  • Ubuntu Machine hostname command hostname: JOHNDOE
  • Ubuntu username: mark
  • Username in the id_rsa.pub: ...fsdfsdfsdfsd mark@JOHNDOE

So as you can see, my user in Ubuntu is mark and the ssh rsa key generated has a mark@JOHNDOE as last domain. But should it be john.doe@JOHNDOE instead (both in Ubuntu user and in the ssh pub key)?

And let's say that for some reason I cannot change the user in my Ubuntu machine.

I honestly think the answer is no and the issue is on my user in Gitlab that has some missing permissions or some network related problem, and I'm just paranoid but just to make sure that is not related with the ssh keys. I think the ssh key just need to match the one in Gitlab and the username in the key has nothing to do (because actually, you can change it with command -C "john.doe@JOHNDOE" which is a Comment and anyway it still gives me errors. But again I have the doubt is ALSO 开发者_StackOverflow中文版the username of the Ubuntu must be john.doe

Command run / Troubleshot

  • OS: Ubuntu 18.04.6 LTS on Windows 10 x86_64 (WSL)
  • I need to connect via VPN (all other https services works via Browser so it should be fine)

Creating ssh

ssh-keygen -t rsa -b 2048

Add SSH

cat ~/.ssh/id_rsa.pub 
# Then copy the key to gitlba key - etc.. 

Also try do

eval $(ssh-agent -s)
ssh-add -D
ssh-add ~/.ssh/id_rsa.pub

Error

Do a git clone

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

Connecting

ssh -T git@gitlab.example.com
banner exchange: Connection to [here the IP but removed] port 22: Connection timed out

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号