ssh_wrapper "ssh -i /some/path/id_rsa"
In case someone comes across this, the above didn't work for me, I kept getting the error:
error: cannot run ssh -i /some/path/id_rsa: No such file or directory
What specifying ssh_wrapper does is it sets the GIT_SSH environment variable, and it turns out you can't provide parameters in the GIT_SSH environment variable (see Git clone with custom SSH using GIT_SSH error).
Instead, you would need to write your script to a file first, then set GIT_SSH to it.
So:
file "/some/path/git_wrapper.sh" do
owner "your_user"
mode "0755"
content "#!/bin/sh
exec /usr/bin/ssh -i /some/path/id_rsa "$@""
end
And change the git resource part to:
git "/opt/mysources/couch" do
repository "git://git.apache.org/couchdb.git"
reference "master"
action :sync
ssh_wrapper "/some/path/git_wrapper.sh"
end
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…