Capistrano Hanging During .tgz Upload

I just spent an annoying amount of time troubleshooting a new cap-based deploy.rb for a Rails app to a new CentOS 6.4 server. The deploy.rb worked perfectly on other systems, but something about the configuration was causing `cap deploy’ to hang during the following:

servers: [“”]
** sftp upload /var/folders/0j/vmvt2by53m901wtmfv8xfjw40000gn/T/20130530225953.tar.gz -> /tmp/20130530225953.tar.gz

Long story short, when manually sftp’ing to the server, I’d get:

Received message too long 458961005

Ah ha! After taking a cue from this dude, I edited the .bashrc to redirect any output to /dev/null. I could then successufully sftp to the server manually, and `cap deploy’ magically worked as expected. The offending line was actually rvm, which of course insists on print a color-coded message when you `rvm use 2.0.0′ (or whatever). Changing the offending line to:

rvm use 2.0.0 >> /dev/null

..did the trick.