Dokku asking for password when trying to git push

此生再无相见时 提交于 2019-12-08 18:36:47

问题


I have created a droplet on digital ocean with an image of ubuntu and dokku. I have followed this tutorial to deploy my app, I have also done the configuration to add my ssh key to dokku. Now when I try to "git push [name] master" I get asked for "dokku@domain" password.


回答1:


I had this problem too because I work from multiple machines so even though I uploaded both public ssh keys to digital ocean prior to creating the droplet when I went to sign in I could do so on both machines if I was logging in as the user 'root',

however when I went to push for the first time using

$ git remote add dokku dokku@my.server.url
$ git push dokku

like it does in the digital ocean guide i was following.

I found out that the user 'dokku' only had one of the keys loaded in its authorized keys file.

so here is what I did. In my terminal I used $ cat ~/.ssh/id_rsa.pub which will display your public ssh key and I highlighted that whole thing and copied that.

I logged in to my server as the root $ ssh root@my.server.url then made my way to the dokku users authorized keys folder $ cd /home/dokku/.ssh/

I then open that $ nano authorized_keys now in this file I already had one key but you might not have any. In either case I pasted my ssh-key in this file and exited the file.

From there I was pretty much good now if I push using the dokku user it doesn't ask for a password because it already recognizes my ssh-key. By the way there is a way to simplify all this to like two steps but sometimes I like to go about it the long way just to make sure the key actually made it into the file.




回答2:


Try adding your local SSH key in DigitalOcean control panel, then delete the old droplet and create a new one using this key. Now when you open droplet IP in the browser you should see Dokku Setup page with your key, after finishing setup git push should work.




回答3:


Make sure that you add DigitalOcean Dokku remote on your LOCAL computer. If you will try to add it on DO droplet (yes, I made that stupid mistake) you will be asked for password.




回答4:


I had the same problem. I used this digital ocean tutorial

I'm a windows 8 user. I found I had two error:

  1. So I used puTTy as per the tutorial to generate my public and private SSH keys. Despite that, I found that my public key (id_rsa.pub) was wrong when I opened up Ruby on Rails with Command Prompt. You can change it by using git bash (allows windows users to use the linux terminal) editing the file via a text editor (I prefer to use vi ... commands are here)

  2. Following the SSH tutorial for windows, it doesn't tell you to modify the sshd_config file (link to that tutorial here). It's at "Step Six—Lockdown Root SSH Access to Keys Only". Once again, use gitbash to edit the sshd_config file via the text editor of your choice to make sure it has this configuration: PermitRootLogin without-password

That solved it for me. Hope it helps you guys.




回答5:


This have happened to me. The cause was that my .ssh/id_rsa.pub key did not match the one I used when setting up Dokku.

The way I fixed this was to create a new key file in the Dokku server, paste inn my own SSH key, and then run: sudo dokku ssh-keys:add my_key_name /home/$USER/.ssh/my_key.pub

This will add your key to the Dokku authentication key file from the file in the given path.



来源:https://stackoverflow.com/questions/23277169/dokku-asking-for-password-when-trying-to-git-push

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!