When I checked the ssh connection to GitLab, I found that Permission denied (publickey).

Asked 2 years ago, Updated 2 years ago, 141 views

Problems you are having

I get an error when I try to use ssh to connect to Gitlab's repository, which should have been connected and pushed before.

 [vagrant@localhost~]$ ssh-T [email protected]
Permission denied (publickey).

What I've done to solve

https://qiita.com/redamoon/items/07e445d1fce360cb5fa3
↑Re-create public and private keys by referring to this article

 [vagrant@localhost~]$ ssh-keygen-C "Address at Login ス@fuga.com" - trsa

Edit ~/.ssh/config as follows

Host gitlab  
    HostName gitlab
    User git
    IdentityFile through /.ssh/id_rsa

Display the public key (id_rsa_pub) and copy "ssh-rsa ~ just before email address" and add a new one in Gitlab SSH Keys settings

Connection check results in the first error

[[email protected]]$ssh-T [email protected]
Permission denied (publickey).

The public and private keys created above have keys created with the same name before, so

/home/vagrant/.ssh/id_rsa already exists.
Overwrite(y/n)?y

↑ Overwrite and recreate here

I can't figure out the cause of this error or how to solve it, so I'm at a loss...
It would be very helpful if you could tell me the cause and the solution.Thank you for your cooperation.

git ssh gitlab

2022-09-30 19:32

1 Answers

I was trying to connect to [email protected] without noticing that the remote repository was using something other than Saas from GitLab...
I checked the connection with the correct URL and found that the connection was successful.


2022-09-30 19:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.