Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kris01's avatar

Git Ssh

Hello guys, I have generated new keys, i have added the public key to the ssh server, and when i try to login via ssh it says

Permission denied (publickey).

How could I solve this?

0 likes
11 replies
Snapey's avatar

What does this have to do with git?

Kris01's avatar

@Snapey how can I solve this? I need to pull on a git repository

Snapey's avatar

go to the user's home folder and cd .ssh

Add your public key to the authorized_keys file

Make sure the file is owned by the user and that the permissions are 600.

eg, if your user is kris

chown -R kris:kris /home/kris/.ssh
chmod 0700 /home/kris/.ssh
chmod 0600 /home/kris/.ssh/authorized_keys
Kris01's avatar

@Snapey ok so what I am doing is:

ssh root@ipaddress

and I am getting

Permission denied (publickey).

I didn't find any authorized_key file, so I created one manually and added the .pub key inside but still nothing

Kris01's avatar

@Snapey yes, authorized_keys but still nothing. I'm on windows by th way

Snapey's avatar

Just to be clear

You are trying to log into your server with SSH

or

You are already logged in to your server and you are trying to pull from some cloud provider

Please or to participate in this conversation.