【问题标题】:Capistrano connect to remote_dir with also specifying a specific portCapistrano 连接到 remote_dir 并指定特定端口
【发布时间】:2014-08-14 01:36:36
【问题描述】:

我发现了一个 github gist,其中有人在本地编译 rails 资产,然后将它们复制到服务器。

它无法连接到服务器,很可能是因为我将 ssh 端口更改为 90。

我怎样才能让这个变量使用端口 90 连接?

remote_dir = "#{host.user}@#{host.hostname}:#{shared_path}/public/assets/"

通常当我通过 ssh 连接到服务器时,我会这样做:

ssh myUser@myServer -p90

https://gist.github.com/Jesus/80ef0c8db24c6d3a2745

【问题讨论】:

    标签: ruby-on-rails ssh capistrano assets capistrano3


    【解决方案1】:

    这个问题好像以前有人问过:Is it possible to specify a different ssh port when using rsync?

    诀窍是使用:

    run_locally { execute "rsync -av -e 'ssh -p 90' --delete #{local_dir} #{remote_dir}" }
    

    而不是

    run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" }
    

    【讨论】:

      猜你喜欢
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 2011-05-27
      • 2016-03-13
      • 1970-01-01
      • 1970-01-01
      • 2012-04-12
      • 2021-07-15
      相关资源
      最近更新 更多