I also needed a solution, but I could not find a satisfactory answer anywhere. After reading the Ruby Net :: ssh documentation and some Compass source, this is my solution to upload CSS and sourcemap to a remote SSH server with a non-standard port and public key authorization:
First, make sure you have the necessary stones installed.
sudo gem install net-ssh net-sftp
then add this to your config.rb
# Add this to the first lines of your config.rb require 'net/ssh' require 'net/sftp' ...
It was pretty simple trial and error until it worked for me. Some points of failure:
- If ssh-agent is not available, the connection will fail until you explicitly set
:ssh_agent => false - If you do not limit the keys to available keys: all available keys will be checked one by one. If you use ssh-agent and have more than 3 keys, chiki is installed that the remote server will close the connection if you try too many keys that are invalid for the server that you are currently connecting.
- For any connection issues, set the level of detail to
:verbose => :debug to see what happens. Remember to stop the compass watch and restart to ensure that the settings are changed.
Jรผrgen hรถrmann
source share