gitにsshのオプションを渡すには、sshをラップしたスクリプトを用意して GIT_SSHで指定してやればいいらしい。
例えば、johndがjdoeというユーザ名でid_rsa_jdoeという鍵を使って loginしたい場合の準備:
% man ssh
% $EDITOR git_ssh_jdoe.sh
% cat git_ssh_jdoe.sh
#!/bin/sh
# git_ssh_jdoe.sh
exec ssh -o User=jdoe -o IdentityFile=/home/johnd/.ssh/id_rsa_jdoe "$@"
%
% chmod +x git_ssh_jdoe.sh
使うときはGIT_SSHを指定してgitを実行する。
% GIT_SSH=git_ssh_jdoe.sh git fetch
Enter passphrase for key '/home/johnd/.ssh/id_rsa_jdoe':
...
%
参考:
- GitTips - Git SCM Wiki
How to pass ssh options in git?
http://git.wiki.kernel.org/index.php/GitTips#How_to_pass_ssh_options_in_git.3F
Other Articles
- 12 May 2011 : onlispja ebook
- 07 May 2011 : 文字校正用ユーティリティ
- 28 Apr 2011 : htdigest設定支援スクリプト
- 15 Apr 2011 : HudsonからJenkinsへの移行
- 11 Apr 2011 : Emacs Lispでert.elを使ってユニットテスト
- 25 Mar 2011 : Jenkins導入
- 11 Mar 2011 : 地震 / Earthquake in Japan