Ruby + git +ssh keys

Problem: i need to verify git repo properties (ssh key,repo url) in ruby

Solutions:

  1. write ssh key into ~/.ssh/id_rsa file and execute “git clone” command
    with repo url property - easiest way
    -cause race conditions when multiple users trying to check theirs repos.
  2. write key into any file and link server and key in ssh.config file
    than execute git in ordinal way
    -ssh.config file has limited lenght(255 records)
  3. add key via ssh-agent and execute git in ordinal way
    -ruby can’t handle passphrase request (if ssh key protected with
    passphrase)

Resume: so i need universal solution (like ssh -i) that is easy to
use,clean,will work in multithread environment and all errors can be
handled via basic IO (exec and so on)