Module: GitSafe::PrivateKeyFile

Included in:
Git
Defined in:
lib/git-safe/private_key_file.rb

Instance Method Summary collapse

Instance Method Details



24
25
26
# File 'lib/git-safe/private_key_file.rb', line 24

def safe_unlink_private_key_tmp_file
  ssh_tempfile&.safe_unlink_private_key_tmp_file
end

#ssh_cmdObject



3
4
5
6
# File 'lib/git-safe/private_key_file.rb', line 3

def ssh_cmd
  return '' unless ssh_private_key_file_path
  "GIT_SSH_COMMAND=\"ssh -i #{ssh_private_key_file_path} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\" "
end

#ssh_private_key_file_pathObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/git-safe/private_key_file.rb', line 8

def ssh_private_key_file_path
  return unless ssh_private_key

  if File.exist?(ssh_private_key)
    logger.info('ssh_private_key key is a file')
    ssh_private_key
  else
    logger.info('ssh_private_key key is a string')
    ssh_tempfile.private_key_temp_file.path
  end
end

#ssh_tempfileObject



20
21
22
# File 'lib/git-safe/private_key_file.rb', line 20

def ssh_tempfile
  @ssh_tempfile ||= SshTempfile.new(ssh_private_key)
end