Method: Match::Storage::GitStorage#command_from_private_key

Defined in:
match/lib/match/storage/git_storage.rb

#command_from_private_key(command) ⇒ Object



179
180
181
182
183
184
185
186
187
# File 'match/lib/match/storage/git_storage.rb', line 179

def command_from_private_key(command)
  if File.file?(self.git_private_key)
    ssh_add = File.expand_path(self.git_private_key).shellescape.to_s
  else
    UI.message("Private key file does not exist, will continue by using it as a raw key.")
    ssh_add = "- <<< \"#{self.git_private_key}\""
  end
  return "ssh-agent bash -c 'ssh-add #{ssh_add}; #{command}'"
end