Permission denied (publickey,gssapi-with-mic) when cloning Git repo
9,357
You shouldn't just copy the key around. Create a new key for the machine you are using in the same way as you created the one you are copying. According to this page, you should do:
-
Create the key
ssh-keygen -t dsa
-
Copy the content of id_dsa.pub file and append it to the target machine's
.ssh/authorized_keys
file. If authorized_keys file is not accessible, then just create.ssh/authorized_keys2
file and paste the key.cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
-
Copy the key to the target machine
ssh-agent sh -c 'ssh-add < /dev/null && bash'
Author by
user962206
Updated on September 18, 2022Comments
-
user962206 over 1 year
I was cloning a Git repository and I had copied my id_rsa key from another PC to my /home/me/.ssh/ on Ubuntu 12.04, however this error shows up:
Permission denied (publickey,gssapi-with-mic).
How would I solve this issue?
-
terdon almost 11 yearsDon't copy the key file directly, use
ssh-copy-id
instead.
-
-
user962206 almost 11 yearsI don't see any authorized_keys under my .ssh folder. should I make it?
-
Flup almost 11 yearsYes, that file has to exist and contain your trusted public key(s).
-
Flup almost 11 yearsAh! I've just realised what you're trying to do. OK, so it looks like you've done the right thing, and your problem might be permissions. Make sure that the keys, and the
.ssh
directory, are only readable by you. -
user962206 almost 11 yearswhat about may old ssh key? will I still be use it?
-
user962206 almost 11 yearshow would I do that?
-
Flup almost 11 years
cd /home/me; chmod 700 .ssh; chmod 600 .ssh/id_rsa .ssh/id_rsa.pub
-
user962206 almost 11 yearsI just typed the code you have given should I expect any outputs? I tried running git again however the error still exists