Gitreceive doesn't work #1608

Closed
tedf20 opened this Issue Oct 25, 2015 · 12 comments

Projects

None yet

3 participants

@tedf20
tedf20 commented Oct 25, 2015

Hello,

My issue is almost identical to #714 and #116

I am using Windows 7 with OpenSSH. I recently set up a ubuntu-dokku droplet on Digital Ocean and configured my SSH key. I can currently log in to either the dokku or root username on my droplet without a password using Putty, WinSCP, and ssh at the command line (OpenSSH).

This is true for me also. I would like to add that my SSH keys are default id_rsa and id_rsa.pub
I have my repo set up on my local machine, and the remote connection is set up, which is proved by

$ git remote -v
demodok dokku@46.101.53.77:demodok (fetch)
demodok dokku@46.101.53.77:demodok (push)
origin  https://github.com/imchairmanm/demo_application.git (fetch)
origin  https://github.com/imchairmanm/demo_application.git (push)

When I do

$ git push demodok master

I get the following:

Warning: Permanently added '46.101.53.77' (ECDSA) to the list of known hosts.
fatal: 'demodok' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I also tried creating and initiating the project folder on the server - in this case git recognizes it and pushes the files, but dokku doesn't recognize the push and doesn't build the app, that is why I made a step back.

I thought of initiating a git recieve script manually on the server, but have found no info about that in case of building a dokku app.

By the way, dokku tracing is on, but I get no additional information.

Now I have literally run out of solutions found over the internet, that is why any help would be greatly appreciated :)

@josegonzalez
Member

When you setup the droplet, you need to still go to the droplet's ip (or domain name) in your web browser and add your ssh key. Did you do that?

@tedf20
tedf20 commented Oct 25, 2015

I am not sure about that, it is possible that I left the field blank and pressed "Finish setup". Now I cannot access the ui through the ip, is it possible to access it now or do I have to create a new droplet?

@josegonzalez
Member

You can add new users using sshcommand like so.

@tedf20
tedf20 commented Oct 25, 2015

I already did that, but it made no effect. To be on the safe side, tried to do this once more now, but again it haven't changed anything.

What is it for? As far as I understand, this command copies the public key to /home/dokku/.ssh/authorized_keys, but I already login to the server as dokku via ssh.

So, does it make sense to create a new droplet and try to insert the public key through the ui?

@josegonzalez
Member

Yeah, keep the old droplet around for now, but try a new one and see if it works if you do it via the web ui. If you can give me steps to reproduce your issue, that would be pretty stellar as well.

@tedf20
tedf20 commented Oct 25, 2015

The problem resolved. I deleted the whole dokku folder from the server and then installed it from scratch via

wget https://raw.githubusercontent.com/progrium/dokku/v0.4.3/bootstrap.sh
sudo DOKKU_TAG=v0.4.3 bash bootstrap.sh

on the remote server. Then executed
cat ~/.ssh/id_rsa.pub | ssh root@46.101.53.77 "sudo sshcommand acl-add dokku descr"
on the host machine to copy the public key correctly. After that I can't login to the server as dokku via ssh any more, instead I get the list of dokku commands and notification Connection to 46.101.53.77 closed., but git push demodok master (I also removed and recreated remote git connection beforehand to be on the safe side, but I doubt that it was necessary) now works as expected, building the app accessible via ip:port.

Not the most elegant solution, but it worked. I suppose the initial issue could be resolved by updating the /home/dokku/.ssh/authorized_keys file. It previously looked like

ssh-rsa AAAAB1<some staff here>Kw== comment
ssh-rsa AAAA3N<some staff here>2w== comment

(I had a key for PuTTY and a key for OpenSSH), and sudo sshcommand acl-add dokku descr somehow didn't change it, whereas now it looks like

command="FINGERPRINT=78:0<some staff here>7:32 NAME=descr `cat /home/dokku/.sshcommand` $SSH_ORIGINAL_COMMAND",no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding ssh-rsa AAAAB3Nz<some staff here>GV comment

@josegonzalez, thank you for pointing me to the issue source

@josegonzalez
Member

Guess there was a bug in how you initially setup your keys. The dokku user is meant to be managed solely by sshcommand, and you aren't supposed to "ssh" in as that user, hence why things seemed to break for you.

@Corstiaan84

I got this error as well but only for NEWLY created apps in my dokku installation, after I changed some access settings for the dokku/git user. How do I configure the dokku user back to it's prefered state? Please do not tell me to do a fresh install... :-).

I needed to restart the server for some tweaks and ended up having to enable password access for the Dokku user. I guess Dokku does not like this?

Thanks for your help!

@josegonzalez
Member

@Corstiaan84 I'd imagine you should take a look at the authorized_keys for the dokku user. It should be in the command="FINGERPRINT... format. If not, you'll need to clear it out and use sshcommand to add your new users.

@Corstiaan84

@josegonzalez, the command="FINGERPRINT" is there. Does that needs some modification, to be removed, or something else?

Thanks!

@josegonzalez
Member

Can you open a new issue describing your situation?

@Corstiaan84

Done. #1813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment