【问题标题】:Issue with Capistrano deployment from Windows permission denied Privatekey来自 Windows 权限的 Capistrano 部署问题被拒绝 Privatekey
【发布时间】:2012-06-14 15:29:15
【问题描述】:

我真的被这个部署困住了,我正在使用来自 railcasts 的 Ryan Bates 代码来部署 capistrano。

这是我的部署

require "bundler/capistrano"

load "config/recipes/base"
load "config/recipes/nginx"
load "config/recipes/unicorn"
load "config/recipes/postgresql"
load "config/recipes/nodejs"
load "config/recipes/rbenv"
load "config/recipes/check"

server "37.188.126.99", :web, :app, :db, primary: true

set :user, "deployer"
set :application, "TWL"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
#set :repository, "git@github.com:acooperman/#{application}.git"
set :repository, "git@github.com:acooperman/TWL.git"
#set :repository, "https://github.com/acooperman/TWL.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

结果如下:

    $ cap deploy:update
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        updating the cached checkout on all servers
        executing locally: "git ls-remote git@github.com:acooperman/TWL.git master"
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly
    *** [deploy:update_code] rolling back
      * executing "rm -rf /home/deployer/apps/TWL/releases/20120611173529; true"
        servers: ["37.188.126.99"]
    Password:
        [37.188.126.99] executing command
        command finished in 340ms
    Command git ls-remote git@github.com:acooperman/TWL.git master returned status code pid 3500 exit 128

如果我交换线上的 cmets

set :repository, "git@github.com:acooperman/TWL.git"
#set :repository, "https://github.com/acooperman/TWL.git"

我得到以下信息:

     * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        updating the cached checkout on all servers
        executing locally: "git ls-remote https://github.com/acooperman/TWL.git master"
    Username for 'https://github.com':
    Password for 'https://acooperman@github.com':
        command finished in 7893ms
      * executing "if [ -d /home/deployer/apps/TWL/shared/cached-copy ]; then cd /home/deployer/apps/TWL/shared/cached-copy && git
     fetch -q origin && git fetch --tags -q origin && git reset -q --hard 418c9e9b1d7b37427a76e6bf98a17722f3a9e863 && git clean -q
     -d -x -f; else git clone -q https://github.com/acooperman/TWL.git /home/deployer/apps/TWL/shared/cached-copy && cd /home/depl
    oyer/apps/TWL/shared/cached-copy && git checkout -q -b deploy 418c9e9b1d7b37427a76e6bf98a17722f3a9e863; fi"
        servers: ["37.188.126.99"]
    Password:
        [37.188.126.99] executing command
     ** [37.188.126.99 :: out] error: The requested URL returned error: 401 while accessing https://github.com/acooperman/TWL.git/
    info/refs
     **
     ** fatal: HTTP request failed
        command finished in 1590ms
    *** [deploy:update_code] rolling back
      * executing "rm -rf /home/deployer/apps/TWL/releases/20120611173441; true"
        servers: ["37.188.126.99"]
        [37.188.126.99] executing command
          command finished in 331ms
    failed: "sh -c 'if [ -d /home/deployer/apps/TWL/shared/cached-copy ]; then cd /home/deployer/apps/TWL/shared/cached-copy && gi
    t fetch -q origin && git fetch --tags -q origin && git reset -q --hard 418c9e9b1d7b37427a76e6bf98a17722f3a9e863 && git clean -
    q -d -x -f; else git clone -q https://github.com/acooperman/TWL.git /home/deployer/apps/TWL/shared/cached-copy && cd /home/dep
    loyer/apps/TWL/shared/cached-copy && git checkout -q -b deploy 418c9e9b1d7b37427a76e6bf98a17722f3a9e863; fi'" on 37.188.126.99

Git 在我的新 vps 上运行良好,不需要密码。

我真的被困在这里,任何帮助都将不胜感激,我对 capistrano 完全陌生,对 rails 也很陌生,所以这确实让我很难过。

感谢您的帮助:)

亚当

【问题讨论】:

    标签: ruby-on-rails deployment github capistrano


    【解决方案1】:

    您的 ssh 密钥似乎不在默认位置,请尝试手动设置 ssh 密钥的通行证

    ssh_options[:keys] = ["PATH TO SSH/id_rsa]
    

    【讨论】:

    • 对不起 :( ,我使用的是 aptana studio 控制台,导致 ssh 转发失败,我从 git+ 控制台运行命令,它运行得像梦一样。我还有其他的出牙问题,但我认为它们是无关的。不过感谢您的回答!
    猜你喜欢
    • 2014-01-03
    • 1970-01-01
    • 2014-04-18
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2011-05-15
    • 1970-01-01
    相关资源
    最近更新 更多