也许是一个相当不寻常的情况,但我想指定一个私有SSH密钥,以便在从本地计算机执行shell(git)命令时使用.
基本上是这样的:
git clone git@github.com:TheUser/TheProject.git -key "/home/christoffer/ssh_keys/theuser"
Run Code Online (Sandbox Code Playgroud)
甚至更好(在Ruby中):
with_key("/home/christoffer/ssh_keys/theuser") do
sh("git clone git@github.com:TheUser/TheProject.git")
end
Run Code Online (Sandbox Code Playgroud)
我见过使用Net :: SSH连接到远程服务器的示例,它使用指定的私钥,但这是一个本地命令.可能吗?