2013-09-26 1 views
1

카피 스트라 노를 사용할 준비를하는 방법에 대한 몇 가지 문서를 읽었으며 그 중 카피 스트라 노 웹 사이트의 "인증 및 승인"이있었습니다. 내가이 명령Capistrano를 사용하여 배포하려고하지만 원격 컴퓨터에서 ssh-agent를 실행해도 ID가로드되지 않아서 git 명령이 실패합니다. 왜?

[email protected] $ ssh [email protected] 'hostname; uptime' 

하지만를했을 때 내가이 명령 건너 때

은 모두 내가 가진

[email protected] $ ssh -A [email protected] 'git ls-remote [email protected]:team/application.git 

.. 멋쟁이가는 내가하기로 결정 지칠대로 지친

Permission denied (publickey). 

ssh를 배포 사용자로 직접 서버에 연결하고 거기에서 내 명령을 시도하지만 내 암호를 묻는 메시지가 나타납니다.

[email protected]:~$ ssh [email protected] 
... bunch of logon information ... 

[email protected]:~$ git ls-remote [email protected]:team/application.git 
Enter passphrase for key '/home/deployer/.ssh/id_rsa': 

암호를 입력하고 bitbucket에서 응답을 받았습니다. 이제 ssh-agent가 내 ID를로드해야하고 모든 것이 배치 자와 bitbuckt와 함께 잘되어야하기 때문에 왜 내가 암호문을 요청했는지 이해할 수 없었습니다. 나는 ssh를 에이전트가 내 정체성

ssh-add -l 

을 실행하여로드 한 여부를 확인하기로 결정하지만 나는

Could not open a connection to your authentication agent. 

무엇

있어? 좋아, 그럼 난 SSH 에이전트를 시작하고 내 정체성이

[email protected]:~$ eval "$(ssh-agent)" 
Agent pid 30113 
[email protected]:~$ ssh-add -l 
The agent has no identities. 
[email protected]:~$ ssh-add 
Enter passphrase for /home/deployer/.ssh/id_rsa: 
Identity added: /home/deployer/.ssh/id_rsa (/home/deployer/.ssh/id_rsa) 
[email protected]:~$ ssh-add -l 
2048 6c:87:f9:e1:71:75:0d:1c:cf:8d:d8:a8:06:fc:70:e7 /home/deployer/.ssh/id_rsa (RSA) 

을 수행하여로드 확인했다 지금은 내 암호를 입력하지 않고도 잘의 bitbucket에서 내 원격 목록을 할 수

[email protected]:~$ git ls-remote [email protected]:team/application.git 
f25db5c4691531c8ad27882c74d9668de66f795f HEAD 
97a68f4f6cbffd0c320b37891ffdda57931146f4 refs/heads/deployer 
f25db5c4691531c8ad27882c74d9668de66f795f refs/heads/master 
[email protected]:~$ 

지금 서버에서 로그 아웃하여 기권했습니다. 내 로컬 컴퓨터에서 다시 시도했습니다.

[email protected]:~$ exit 
logout 
Connection to server.com closed. 
[email protected]:~$ ssh [email protected] 'git ls-remote [email protected]:team/application.git' 
Permission denied (publickey). 
fatal: The remote end hung up unexpectedly 

??? 내 문제가있다 ... 이제 내가 잘못 될 곳을 볼 수 있니?

답변

0

한 번 로그인하여 ssh-agent를 시작하고 키 (ssh-add)를 에이전트에로드 할 수 있습니다. ssh-agent의 결과를 어떤 파일에 저장하십시오.

git 목적으로 원격 로그인 할 때 저장된 정보를 사용하여 bashrc 또는 다른 시작 스크립트를 통해 SSH_AUTH_SOCK 및 SSH_AGENT_PID를 설정하십시오. 당신은 새로운 ssh-agent를 원하지 않는다. 이미 키가있는 것과 동일한 것을 가리켜 야합니다.

+0

좋아, 내가 'pidof ssh-agent'를 실행하는지 알 수있다. 이제 SSH_AUTH_SOCK 및 SSH_AGENT_PID를 설정하는 방법을 찾으려고 노력할 것입니다. 덕분에 ... 내가 이것을 작동시킬 때 올바른 답으로 표시 할 것입니다. :) – bjorgvin

+0

@ http://superuser.com/questions/141044/sharing-the-same-ssh-agent에서 문제에 대한 좋은 해결책을 찾았습니다. -among-multiple-login-sessions 스크립트가 git repo에 있습니다. https://github.com/intuited/sshag – bjorgvin

+0

음 ... 주어진 스크립트를 사용하여 에이전트를 설정할 수 있습니다. 하지만 지금은 배포자로 내 서버에 ssh에 내 암호를 제공해야합니까 ?? 그래서 지금 내가 ssh -a [email protected] 'sshag'할 때 암호문을주고 명령 sshag을 알 필요가 있습니까 ?? .bashrc에 있고 서버에 ssh를 실행 한 다음 sshag를 실행하면 제대로 작동합니까 ?? – bjorgvin

관련 문제