Specify private SSH-key to use when executing shell command with or without Ruby?
Posted
by
Christoffer
on Stack Overflow
See other posts from Stack Overflow
or by Christoffer
Published on 2010-12-30T19:42:01Z
Indexed on
2010/12/30
19:54 UTC
Read the original article
Hit count: 292
A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer.
Basically like this: git clone [email protected]:TheUser/TheProject.git -key "/home/christoffer/ssh_keys/theuser"
Or even better (in Ruby):
with_key("/home/christoffer/ssh_keys/theuser") do
sh("git clone [email protected]:TheUser/TheProject.git")
end
I have seen examples of connecting to a remote server with Net::SSH that uses a specified private key, but this is a local command. Is it possible?
Thanks
© Stack Overflow or respective owner