
どうして github からクローンするときにパスフレーズを求められるのでしょうか?
git clone [email protected]:test/testchef.git
Cloning into 'chef'...
The authenticity of host 'github.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
Enter passphrase for key '/root/.ssh/git_id_rsa.pub':
これが私のSSH設定ファイルです:
Host *github.com
IdentityFile ~/.ssh/git_id_rsa.pub
ファブリックから実行する場合、エラーは発生しませんが、クローンしようとするとパスフレーズの入力を求められます。def bootstrap(): put('ssh_config','/root/.ssh/config') put('git_id_rsa.pub','/root/.ssh/git_id_rsa.pub') put('git_id_rsa','/root/.ssh/git_id_rsa') run("""chmod 600 /root/.ssh/git_id_rsa*""") run("""eval ssh-agent -s
;ssh-add /root/.ssh/git_id_rsa""")
ファブリックからの関連出力:
[107.170.196.221] out: Agent pid 2285
[107.170.196.221] out: Identity added: /root/.ssh/git_id_rsa (/root/.ssh/git_id_rsa)
[107.170.196.221] out:
サーバーにログインし、コマンドラインから以下を実行します eval ssh-agent -s
;ssh-add /root/.ssh/git_id_rsa git clone[メールアドレス]:test/testchef.git
素晴らしい。パスフェーズを要求せずにクローンを作成できます。Fabric からはなぜ機能しなかったのでしょうか?
答え1
ID ファイルは公開鍵ではなく秘密鍵であるため、次のようになります。
Host *github.com
IdentityFile ~/.ssh/git_id_rsa # Without the .pub