2017-01-19 7 views
2

リモートサーバでsshキーのパスフレーズが設定されていると、Capistranoでのデプロイが失敗します。サーバのsshキーにパスフレーズがあると、Capistranoのデプロイメントに失敗する

しかし、誰パスフレーズが設定されていないとき、それは動作します...

私はまだサーバー上のパスフレーズを使用できるように展開するときにパスワードを入力できるようにしたいと思います。

エラー:

01 mkdir -p /tmp 
01 <user>@<ip> 0.183s 
Uploading /tmp/git-ssh-<app>-<env>-<me>.sh 100.0% 
02 chmod 700 /tmp/git-ssh-<app>-<env>-<me>.sh 
02 <user>@<ip> 0.178s 
git:check 

01 git ls-remote --heads [email protected]:<me>/<my-repo>.git 
01 Permission denied (publickey). 
01 fatal: Could not read from remote repository. 
01 
01 Please make sure you have the correct access rights 
01 and the repository exists. 

cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as <user>@<ip>: git exit status: 128 
git stdout: Nothing written 
git stderr: Permission denied (publickey). 
fatal: Could not read from remote repository. 

deploy.rb

lock '3.7.1' 
set :application, '<app>' 
set :repo_url, '[email protected]:<me>/<app>.git' 
set :user, '<user>' 
set :scm_user, '<me>' 
set :deploy_to, '/home/<user>/<app>' 
set :scm, :git 
set :branch, 'master' 
append :linked_files, 'config/database.yml', 'config/secrets.yml' 
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle" 

デプロイ/ production.rb

server '<ip>', user: '<user>', roles: %w{app db web} 

だから私は希望リー私のサーバがgithubに接続するために使用するために、私はCapistranoが私にパスワードを要求しています。

これは可能ですか?

+0

あなたはCapistranoのサイトの指示に従ってしようとしたことがありますか? http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/ – CryptoPiggy

+0

「SSHエージェントフォワーディング」のセクションをチェックしてください。 – CryptoPiggy

答えて

2

SSHエージェントフォワーディングを使用することができます。したがって、サーバにパスフレーズを入力する必要はありません。

このようにして、ローカルでssh-add keyname_rsaのsshキーをプリロードして、自動的にホストに転送し、必要に応じてホストからGithubサーバーに自動的に転送させます。

enter image description here

を、残りは展開時に「自動的に」行われます

だから、これだけのように一度ローカルパスフレーズを入力してください。それは設定する価値がある。 the docsから

1.2.1 SSH Agent Forwarding

As we’ve already set up an SSH agent, we can use the agent forwarding feature of SSH to make this key agent available to further hops. In short, we can use our own ssh key to authenticate ourselves from the server to Github.

関連する問題