2017-01-19 8 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에 연결할 수 있도록합니다.

이것이 가능합니까?

+0

당신은 카피 스트라 노 사이트의 지침에 따라 시도? http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/ – CryptoPiggy

+0

'SSH 에이전트 전달'섹션을 확인하십시오. – CryptoPiggy

답변

2

SSH 에이전트 전달을 사용할 수 있습니다. 따라서 서버에 암호를 입력 할 필요가 없습니다.

이렇게하면 로컬에서 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.