Question

Git push dokku master is returning permission denied

Please help me set up git to use ssh for my first deployment


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.

KFSys
Site Moderator
Site Moderator badge
March 17, 2021
Pinned Answer

Hi @corylahn,

After creating a Dokku One-Click Droplet, you need to visit the Droplet’s IP address in a browser to finish configuring Dokku. If you don’t, the Dokku instance will be vulnerable to anyone who finds the setup page and inserts their key.

When you visit the setup page, you’ll see three fields:

  1. Public Key
  2. Hostname
  3. Use virtualhost naming for apps:

Since this topic is about the Public key, we’ll only be talking about that one but if anyone wants to learn more about dokku and the other configuration during setup they can do it here Dokku Quickstart

Now, onto the Public key! During the setup process, If you uploaded an SSH key to the Droplet when you created it, this field will be pre-populated with your public key. If not, add an SSH public key here.

Please note that you need to add your Public key file here! Usually, that’s the file id_rsa.pub.

Having said that if by any reason you can’ push to git afterwards and you want to change/add/remove an SSH key, there is a pretty easy way to do so from your Droplet.

SSH to your droplet

ssh root@DropletIp

You have 3 commands which can help you manage your keys:

ssh-keys:add <name> [/path/to/key] 
ssh-keys:list [--format text|json] [<name>]
ssh-keys:remove [--fingerprint fingerprint|<name>]

I’ll go over the 3 commands where I’ll just mention the list and remove command and give more information on the add command as this is what we are after now.

USAGE

  • Listing SSH keys

You can use the ssh-keys:list command to show all configured SSH keys. Any key added via the dokku-installer will be associated with the admin key name.

dokku ssh-keys:list
  • Removing SSH keys

As key names are unique, they can be used to remove a public SSH key.

dokku ssh-keys:remove KEY_NAME

An SSH Key can also be removed by fingerprint.

dokku ssh-keys:remove --fingerprint FINGERPRINT

Both KEY_NAME and FINGERPRINT can be found using the dokku list command.

  • Adding SSH keys

Now, onto what we are after! You can add your public key to Dokku with the ssh-keys:add command. The output will be the fingerprint of the SSH key.

dokku ssh-keys:add KEY_NAME path/to/id_rsa.pub

KEY_NAME is the name you want to use to refer to this particular key. Including the word admin in the name will grant the user privileges to add additional keys remotely. Alternative way to add your SSH key and the one I use is running the below command on your local enviroment(laptop) the following command:

cat ~/.ssh/id_rsa.pub | ssh root@dokku.me dokku ssh-keys:add KEY_NAME

Regards, KFSys

Accepted Answer

nm, got it

When I try to put the ipv4 on a browser it redirects me to a ngix web without any options to do something. If I use the private ip on the browser, it doesnt work

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel