Created
September 22, 2009 16:20
-
-
Save Packetslave/191209 to your computer and use it in GitHub Desktop.
Make capistrano use SCP instead of SFTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deployment uses SFTP by default when you use deploy_via :copy, and there | |
# doesn't seem to be any way to configure it. Unfortunately, we don't run | |
# SFTP on our servers, so it fails. This forces it to use SCP instead. | |
# http://www.capify.org/index.php/OverridingTaskCommands | |
# | |
module UseScpForDeployment | |
def self.included(base) | |
base.send(:alias_method, :old_upload, :upload) | |
base.send(:alias_method, :upload, :new_upload) | |
end | |
def new_upload(from, to) | |
old_upload(from, to, :via => :scp) | |
end | |
end | |
Capistrano::Configuration.send(:include, UseScpForDeployment) |
Thank you!
Looks like the method signature of 'upload' has changed. I think this gist needs to change like this;
def new_upload(from, to, options = {}, &block)
old_upload(from, to, options.merge(:via => :scp), &block)
end
I actually had to use this today. Is this something that should be filtered down through the :copy_via parameter?
This seems to work halfway for me. The file gets scp'd over (I see it on the remote server in the /tmp directory) but cap throws an error saying "SCP did not finish succesfully".
Anyone see this problem?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great it works!!
and helped me a lot . Thanks :-)