ekho / capistrano-git-submodule-strategy

Git submodule support for Capistrano 3
MIT License
47 stars 20 forks source link

Error - fatal: destination path '/var/sites/s/staging/public_html/releases/xxxxxx' already exists and is not an empty directory. #2

Closed henscu closed 10 years ago

henscu commented 10 years ago

I modified my files as described in your Readme, ran bundle update and then bundle exec cap staging deploy.

All looks good until I get the following error. I hope it's due to some basic mistake on my part(!) as the directory it is complaining about looks like it is meant to exist as it's the one we are deploying to...

https://gist.github.com/henscu/b38b0943b14b20358b6b

Thanks, H

henscu commented 10 years ago

I found a comment about this on StackOverflow:

http://stackoverflow.com/a/24690474/3403466

It suggests this solution:

NOTE: you may have problem with the repo folder if you already tried with the default git strategy. >Simply go to the deploy directory on server and remove it and then run cap deploy again to fix.

When I have tried it I will report back...

mischka commented 10 years ago

I have tried this solution without any success. Is there an other way?

henscu commented 10 years ago

Mischka, thanks for checking this out. I have not checked it yet as I got an alternative/simpler solution to work. I am using Capistrano Version: 3.2.1 (Rake Version: 10.3.2).

The alternative solution I found is to override the standard Capistrano Git task as described here (I'm not a Ruby or Git expert, just repeating what I read...):

http://www.developerblogger.com/73_22836153/

It uses the code described here:

https://gist.github.com/corny/7459729

The developerblogger link above suggests putting the code in lib/capistrano/tasks/git.cap, but in this comment Derek Tia (dtia) says just to add the code to deploy.rb as is:

https://gist.github.com/corny/7459729#comment-996217

So I just added the code to deploy.rb and it works for me.

Please let me know if it works for you as well and what version of Capistrano you are using.