You may see this error "Permission denied (publickey)¨ when trying to SSH into a project.
To troubleshoot this, make sure your public key has been uploaded to your user account. Check it in the Platform.sh Console.
Redeploy your environment
If you have just added your SSH key or made changes to access rules, you need to redeploy your environment before you can access it using SSH keys. You can do this in the Console, by running platform redeploy
, or by pushing an empty git commit:
git commit --allow-empty -m 'chore: force redeploy'
git push origin main
SSH key cannot be duplicated
A given SSH key pair can only be linked to a single user account. Generate a new pair of SSH keys for the second user account.
Check your SSH agent
Check that your key is properly added to your SSH agent. This is an authentication agent that manages your private key.
-
Run
ssh-add -l
in your terminal:ssh-add -l
- Check that the file exists and that the file name or comment matches your private key file.
- If you don’t see your private key file, add your private key:
ssh-add path-to-your-key
Specify your identity files
If your identity (SSH key) associated with Platform.sh isn’t in a default file name (as may be explained in your SSH software manual, for example), you may have to append a specification like the one below so that the SSH software finds the correct key.
Check your git integrations
If your project is integrated with another git provider (such as GitHub), that provider controls git operations. Make sure you have added your public SSH key to your provider and that your user there has access.
Generate SSH debug information
If your private key and public key both look OK but you don’t have any luck logging in, print debugging information. These lines often give clues about what’s going wrong.
Run the SSH command with the -v
option, like so:
ssh -v [SSH-URL]
If something is still wrong, you can open a support ticket and provide SSH debug information.