How do I add ssh keys to an existing droplet when getting Permission denied (publickey).

I provisioned a One-Click Install Gitlab instance a while ago. Since then, I lost the machine I used to provision the box due to a power surge, thus lost the SSH keys as well.

I am now trying to access the box but I am getting a Permission denied (publickey). I have tried a lot of solutions based on what I could get off the internet but to no success.

Can you please help.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You would need to add the key using the DigitalOcean’s console since you’re not able to connect from your local machine.

What you can do is copy the content of your to the /root/.ssh/authorizedkeys file and then you’ll be able to connect to your droplet.

Let me know how it goes.

Hello, @ditjhabas

You can follow this tutorial in order to upload your ssh key to an existing droplet.

Let me know how it goes.