Can't "just" push to remote repo #116

Closed
webdevotion opened this Issue Jul 25, 2013 · 30 comments

Projects

None yet
@webdevotion

Hello

Following the nice Vimeo screencast by @progrium I thought I would give Dokku another shot.
Installing goes smooth, but when I push my local Rails app to my server
I get:

fatal: 'ocean-app' 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.

When I manually create the repo on my server and push ( with success )
I don't get any of the Dokku magic like app detected etc.

What am I missing here?

Thanks.

@alexbeletsky
Contributor

Are you sure you did everything correctly?

You are not supposed to create any repos remotelly, it's gitrecieve job. All you need is to provide your ssh key as document said, then update your local repo with correct remote sync and push there.

@webdevotion

Creating the repo manually was something I did after nothing seemed to work.

  • I'm setting up a new server as we speak
  • I'll document my commands
  • Thanks for your interest in my issue
@alexbeletsky
Contributor

Creating the repo manually was something I did after nothing seemed to work.

yeah, this is not right.. if you do it manually, dokku knows nothing about it.. so build process not initiated.

please describe what you exactly doing, so I'll make sure it's correct :)

@webdevotion

As you know I'm trying to install a new server now. But it's gonna take a while :)
1+ hour left.

@ghost
ghost commented Jul 25, 2013

Ensure you're pushing to git@hostname:reponame instead of hostname:reponame

@webdevotion

Do I need to do anything with my default git user besides executing the gitreceive command?

@progrium
Contributor

Nope. You need to make sure you upload keys though.

On Thu, Jul 25, 2013 at 2:02 PM, webdevotion notifications@github.comwrote:

Do I need to do anything with my default git user besides executing the
gitreceive command?


Reply to this email directly or view it on GitHubhttps://github.com/progrium/dokku/issues/116#issuecomment-21584443
.

Jeff Lindsay
http://progrium.com

@webdevotion

What I see after Dokku has done it's business is:

Be sure to upload a public key for your user:
  cat ~/.ssh/id_rsa.pub | ssh root@domain.me "gitreceive upload-key progrium"
  • I did that with my non-default ssh key ( webdevotion.pub in stead of id_rsa.pub )
  • I specified ocean in stead of progrium
  • I figured ocean refers to the name of the remote ( git remote -v shows 2 remotes, ocean and origin )
  • I can ssh login to my server with my root user successfully using the keys
  • I can not ssh login to my server with my git user without being asked about my password
  • When and how is the git user's password set anyway?

Maybe I don't get how the git user is supposed to work.

@asm89
Member
asm89 commented Jul 25, 2013

Are you using different keys for the git and the root user? AFAIK you can't use different ssh-keys on the same host without some magic.

@webdevotion

Nope. Same keys.

@progrium
Contributor

git user has no password, it relies on keys. you should never be able to
login via ssh to the git user, it's made to only be accessed with the git
client. if you're not using your default key (this is likely the problem),
you will have to add to your ~/.ssh/config a Host entry for your server
that specifies the default key to use. This is because you cannot pass a
key identity through git when you do the git push, it always assumes
default. The only way to set it is to configure SSH to use a different key
by default for that host. So you could do that, or upload your default ssh
key.

On Thu, Jul 25, 2013 at 2:09 PM, webdevotion notifications@github.comwrote:

What I see after Dokku has done it's business is:

Be sure to upload a public key for your user:
cat ~/.ssh/id_rsa.pub | ssh root@domain.me "gitreceive upload-key progrium"

  • I did that with my non-default ssh key ( webdevotion.pub in stead of
    id_rsa.pub )
  • I specified ocean in stead of progrium
  • I figured ocean refers to the name of the remote ( git remote -v
    shows 2 remotes, ocean and origin )
  • I can ssh login to my server with my root user successfully using
    the keys
  • I can not ssh login to my server with my git user without being
    asked about my password
  • When and how is the git user's password set anyway?

Maybe I don't get how the git user is supposed to work.


Reply to this email directly or view it on GitHubhttps://github.com/progrium/dokku/issues/116#issuecomment-21584863
.

Jeff Lindsay
http://progrium.com

@webdevotion

Ok thanks @progrium. I know where to look now.

@webdevotion

Great!

$ git push ocean master
Counting objects: 206, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (193/193), done.
Writing objects: 100% (206/206), 42.38 KiB, done.
Total 206 (delta 73), reused 0 (delta 0)
remote: -----> Building lacto-rails ...
remote:        Ruby/Rails app detected
@ghost
ghost commented Jul 26, 2013

@asm89 Using the same public key for different users in the system won't cause any issues

@asm89
Member
asm89 commented Jul 26, 2013

@rhy-jot I know, but from the initial story of @webdevotion I got the feeling he was using different keys for the root and git user.

Anyway, glad it got solved!

@webdevotion

@rhy-jot Thanks for your suggestion:

  • I ran into the problem again
  • this time I knew better what I was doing
  • so I took your advice and used:
________________________________________________________________________________
webdevotion:rails-app[ master ✓ ]
$ git push git@domain.com:rails-app
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream git@domain.com:rails-app master


________________________________________________________________________________
webdevotion:rails-app[ master ✓ ]
$ git push --set-upstream git@domain.com:rails-app master
  • now I was able to push

For future reference:

  • I also placed directives in my ~/.ssh/config file:
Host lacto.me
    HostName domain.com
    IdentityFile ~/.ssh/my-custom-private-key
@suranyami

--set-upstream was the only way I could get this to work as well. I'm using Vagrant on OSX.

My settings:

~/.ssh/config

Host dokkume
HostName dokku.me
Port 2222
IdentityFile "~/.ssh/id_rsa"

Then did git push --set-upstream git@dokkume:sample master

The documentation on setting the SSH keys needs a bit of padding out, I think.

I can't understand why I have to do this. When I just use this:

git remote add dokku ssh://git@dokkume:sample
git push dokku master

I get this:

The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 4b:88:6e:81:bb:39:4f:2b:b4:63:10:78:77:8a:d6:dd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:

And, no password works.

@christiangenco
Contributor

I'm getting this exact same error on Ubuntu 13.10 and 10.04 trying to follow the README example:

$ git clone git@github.com:heroku/node-js-sample.git && cd node-js-sample
$ git remote add dokku dokku@my_domain.com:node-js-app
$ git push dokku master
fatal: 'node-js-app' 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.

Note that the installation happened flawlessly as far as I can tell, and I can log in with the docker user via. ssh just fine:

$ ssh dokku@my_domain.com
Welcome to Ubuntu 13.10 (GNU/Linux 3.11.0-14-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon Dec 16 12:31:33 2013 from MY_IP
$ 

--set-upstream doesn't work either:

$ git push --set-upstream dokku@my_domain.com:sample master
fatal: 'sample' 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.

What am I doing wrong? D:

@plietar
Contributor
plietar commented Dec 16, 2013

@christiangenco How did you setup your ssh keys ?
You must use sshcommand acl-add, and not manually.
If you've setup the keys properly, You should not be able to connect as the dokku user. It should just return immediately, doing nothing.

@christiangenco
Contributor

Ahh that fixed it! I was using keychain.io like in Jeff's video without realizing acl-add was doing anything extra.

Thank you!

@motin
Contributor
motin commented Apr 10, 2014

@plietar Thanks, you got me on the right track. I had added the public key manually to /home/dokku/.ssh/authorized_keys and then run the sshcommand acl-add (according to instructions here: https://www.digitalocean.com/community/questions/dokku-add-new-ssh-key), resulting in a file looking like:

command="FINGERPRINT=d6:82:95:68:68:3e:2f:12:3c:ee:46:63:cc:35:92:6e NAME=admin `cat /home/dokku/.sshcommand` $SSH_OR....
ssh-rsa AAAAB3NzaC1yc2EAAAAJKHDSKAJDAHJKDSKJHADSKJHDSHKJASDJKHSADJKASDHJKASD...
command="FINGERPRINT=7e:dd:23:15:24:60:5f:fe:e2:55:d6:c4:d0:e5:29:27 NAME=drone `cat /home/dokku/.sshcommand` $SSH_OR....

But it was not working. To make it work, I had to remove the manually added ssh key so that the file looked like:

command="FINGERPRINT=d6:82:95:68:68:3e:2f:12:3c:ee:46:63:cc:35:92:6e NAME=admin `cat /home/dokku/.sshcommand` $SSH_OR....
command="FINGERPRINT=7e:dd:23:15:24:60:5f:fe:e2:55:d6:c4:d0:e5:29:27 NAME=drone `cat /home/dokku/.sshcommand` $SSH_OR....
@joshuairl

I think it would be helpful if the getting started in README made less assumptions about the installing user's knowledge. For instance...
When it says "Do something like the following..." cat ~/.ssh/id_rsa.pub | ssh progriumapp.com "sudo sshcommand acl-add dokku progrium"

ssh command acl-add dokku progrium?

what's dokku and what's progrium in this command?

For me, and my knowledge... I couldn't discern if I was supposed to type that... I assume I'm supposed to replace "dokku" and "progrium" with my respective system's user?

@joshuairl

Also, on the Troubleshooting guide in the wiki that talks about the "fatal: 'NAME' does not appear to be a repository" it's making assumptions as to WHERE the changes need to be made...
I don't know whether the guide is telling me to solve this while logged in to the server or on my local computer...

I do know that with passwordless ssh I generally need to copy the contents of id-rsa.pub to the server's authorized keys file... but is this something else? It really just doesn't explain it well for my knowledge of this in general I think.

Not saying you have to change it... just my suggestion :-/

@ghost
ghost commented May 13, 2014

We should indeed use things like <hostname> and <identifier> in place of what we have now

@jshawl
jshawl commented Aug 2, 2014

@motin I just solved this issue by removing every line that starts with ssh-rsa in /home/dokku/.ssh/authorized_keys

@kopax
kopax commented Oct 6, 2014

I totaly agree with @joshuairl
I wanted to try dokku, I am stuck on installing dokku. (supposed to be easy)
Most of information i'm looking for aren't in the documentation, I missed something or something isn't clear enough for me.
Where can I know if dokku can gitreceive from a distant web server (gitlab) ?
How does it work ? do I need to add a public key on my gitlab server into /home/git/.ssh/authorized_keys of git user ?
When i add a remote branch from my working computer, do I have to push on dokku address ?

@motin
Contributor
motin commented Oct 6, 2014

@kopax I too agree, the documentation for the current master branch is spread out across pull request comments or plain missing. Documentation-clarifying pull requests are very welcome, and do ask questions on Stackoverflow tagged Dokku, even if you already found the answer! :) Remember, Dokku is more a proof of concept than a tool to be used in production. That said, it can be worth using in production due to it's cheap initial price for smaller projects. In all cases it acts as a good testing ground to configure your app to support deployments through buildpacks.

I can recommend reading up on how it works and taking some time to read the source code (there are not very many lines of code). Don't forget to add "export DOKKU_TRACE=1" to "/home/dokku/dokkurc" when troubleshooting.

To get a Dokku host provisioned with specific versions of Dokku, Buildstep, Docker and some plugins, check out https://github.com/neam/dokku-host-provisioning.

@priyatam

I created a Dokku (0.3.17) image on DigitalOcean running Ubuntu 14.04.2, and can access my server via ssh. I can't deploy the sample node-js app and get the same errors as listed by the @webdevotion, @christiangenco, and @motin.

fatal: 'node-js-sample' 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.

@plietar I setup my SSH like this and can access the server via ssh dokku@[my-ip]. Note that I don't have a domain name.

cat ~/.ssh/id_rsa.pub | ssh root@[my-ip] sshcommand acl-add dokku dokku-keys

What am I missing?

@juanpastas

I have the same problem with a Digital Ocean.

I tried copy my local public key to the server with:

cat ~/.ssh/id_rsa.pub | ssh root@45.xxx.xxx.xxx "sudo sshcommand acl-add dokku added_from_ssh_command"

I am trying pushing with root(and dokku) too:

$ git push root@45.xxx.xxx.xxx:mentoring2 master
fatal: 'mentoring2' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

$ git push dokku@45.xxx.xxx.xxx:mentoring2 master
fatal: 'mentoring2' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights


The file /home/dokku/.ssh/authorized_keys has the first key I added with digital ocean, and a new one that is added with sshcommand.

Any advice?

@josegonzalez
Member

Please open a new issue.

@josegonzalez josegonzalez locked and limited conversation to collaborators Jul 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.