【问题标题】:Newline issues with Capistrano and GitoliteCapistrano 和 Gitolite 的换行问题
【发布时间】:2011-10-29 17:10:23
【问题描述】:

我已经设置了具有 shell 访问权限的 gitolite,并使用 Capistrano 将我的代码部署到生产环境。问题是 Capistrano 将多个命令捆绑在一行中,使用换行符,而 gitolite 具有查找换行符的安全检查,然后死掉。我不确定是从 Capistrano 还是 Gitolite 方面解决这个问题。

我在运行“cap deploy”时看到此错误

executing "rm -rf /home/git/public_html/project/releases/20101129165633/log   
/home/git/public_html/project/releases/20101129165633/public/system 
/home/git/public_html/project/releases/20101129165633/tmp/pids &&\\\n
  mkdir -p /home/git/public_html/project/releases/20101129165633/public &&\\\n  
  mkdir -p /home/git/public_html/project/releases/20101129165633/tmp &&\\\n      ln -s /home/git/public_html/project/shared/log /home/git/public_html/project/releases/20101129165633/log &&\\\n      ln -s /home/git/public_html/project/shared/system /home/git/public_html/project/releases/20101129165633/public/system &&\\\n      ln -s /home/git/public_html/project/shared/pids /home/git/public_html/project/releases/20101129165633/tmp/pids"
servers: ["projectsite.com"]
[projectsite.com] executing command

错误信息:

** [out :: projectsite.com] I don't like newlines in the command: <COMMAND FROM ABOVE>

处理此问题的 gitolite 代码在这里:https://github.com/sitaramc/gitolite/blob/pu/src/gl-auth-command

【问题讨论】:

    标签: ruby-on-rails-3 capistrano gitolite


    【解决方案1】:

    你现在可能已经想通了,但没有看到答案让我很难过。

    您可以使用"; " 连接多个命令,而不是换行符。这是一个示例部署脚本:

    role :server, "projectsite.com"
    namespace :deploy do
        desc "Does whatever beeudoublez wants"
        task :default, :roles => :server, :except => { :no_release => true } do
            run [ "rm -rf /home/git/public_html/project/releases/20101129165633/log /home/git/public_html/project/releases/20101129165633/public/system /home/git/public_html/project/releases/20101129165633/tmp/pids",
                  "mkdir -p /home/git/public_html/project/releases/20101129165633/public",
                  "mkdir -p /home/git/public_html/project/releases/20101129165633/public"].join("; ")
        end
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-16
      • 2019-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多