2012-06-11 76 views
1

我真的堅持這個部署,我正在使用與capistrano部署的瑞典貝茨代碼從railcasts。問題與從Windows的Capistrano部署權限被拒絕Privatekey

這裏是我的部署

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, "[email protected]:acooperman/#{application}.git" 
set :repository, "[email protected]: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 [email protected]: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 [email protected]:acooperman/TWL.git master returned status code pid 3500 exit 128 

如果我換就行了

set :repository, "[email protected]: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://[email protected]': 
     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和相當新的鐵軌,所以這真的讓我難住。

感謝所有幫助:)

亞當

回答

1

看起來像你的SSH密鑰不在默認位置,嘗試通過手動設置你的SSH密鑰

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

對不起:(,我使用的是aptana studio控制檯,它導致ssh轉發失敗,我從git + console運行命令,並且像夢一樣運行。 我仍然遇到一些其他的初始問題,但我認爲它們沒有關係 感謝您的答案,但! – user1339378