views:

1276

answers:

2

I am trying to do 'deploy:cold' for my app. The git repo is local to my deployment server (i.e. I only have one server for everything and I don't host my code on github).

Here is the transcript (replaced my app name with "myapp" for privacy)

  • executing `deploy:cold'
  • executing `deploy:update' ** transaction: start
  • executing `deploy:update_code' executing locally: "git ls-remote /home/mrichman/git/myapp.git master" fatal: '/home/mrichman/git/myapp.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly * [deploy:update_code] rolling back
  • executing "rm -rf /var/www/myapp.com/releases/20100218203108; true" servers: ["myapp.com"] Password: [myapp.com] executing command command finished Command git ls-remote /home/mrichman/git/myapp.git master returned status code 32768

Here is my deploy.rb: http://pastie.org/831424

I have also tried set :repository, "deploy@localhost:/home/mrichman/ git/myapp.git", but that gives me "ssh: connect to host localhost port 22: Connection refused".

Any ideas are appreciated.

Thanks, Mark

A: 

Log in as the user of the site you are deploying to and try this to see if your user has permission to access that directory:

ls -la /home/mrichman/git/myapp.git

If you get a Permission denied error then you'll have to make sure that you set permissions on the enclosing directories of the repository that allow the deployment script to access the files.

rwl4
I have verified that my deploy user has full read access to /home/mrichman/git/myapp.git. Thank you for the comment.
Mark Richman
Try logging into the deploy user account and typing out the failed command manually: "git ls-remote /home/mrichman/git/myapp.git master", it will probably give you the same error, and if it does, log in as the mrichman user and try it as that user. If that still gives an error, which I bet will happen, then you will want to go into the "/home/mrichman/git/myapp.git" directory and type "git status" and if that fails, you'll need to check that the contents of that directory indeed contain a git repository.
rwl4
When I do `git ls-remote` as either my deploy user or my own user I appear to get success: `aa30ffc814fffd96b168ffec7224aeb9fe9df161 refs/heads/master`. I believe `git status` only works on work trees, and not the actual repository.As an experiment, I pushed my repo to Codaset, and my `cap deploy` works fine that way. I can (and probably should) continue that way, as it is unsafe to keep one's SCM on their web server :)
Mark Richman
+3  A: 

Just ran into the same problem. The key is to not use deploy_via copy but rather set :local_repository

This should be set to the URL you use to access the repo from your development computer/laptop.

So mine has

set :repository, "file:///srv/git/myapp.git" set :local_repository, "nameOfHostFromSSHConfig:/srv/git/myapp.git"

Seems to have worked. Just remember to then remove the deploy_via copy line as well.

I now have the following, which also fails:set :repository, "file:///var/git/myapp.git"set :local_repository, "localhost:/var/git/myapp.git"executing locally: "git ls-remote localhost:/var/git/hireexchange.git master"ssh: connect to host localhost port 22: Connection refused
Mark Richman
Are you developing on the same box? If you are I'd imagine :local_repository, "file://var/git/myapp.git" would work.localhost should be replaced with whatever the hostname is that you connect to from your assumed remote workstation.Also I've found that if you have submodules you'll run into more problems doing a deploy like this, because the modules are set to point to a remote URL.Very annoying, but can be solved using .ssh/config on your server under the user you deploy as.
Hi guys. If it makes any difference, git on my local and remote machine required different paths, hence I needed set :git_local /path/to/remote/git and set :git /usr/bin/git (note these do not require the ssh in the beginning).
btelles
I used `set :repository, "/home/#{user}/path/to/repo.git"` instead of the `file:///...` line and it worked like freaking magic! Thanks
pferdefleisch