Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ssh_credentials

Managing Your SSH Key


Description

Utility functions to find or generate your SSH key for use with git remotes or other ssh servers.

Usage

ssh_key_info(host = NULL, auto_keygen = NA)

ssh_keygen(file = ssh_home("id_rsa"))

ssh_setup_github()

ssh_home(file = NULL)

ssh_agent_add(file = NULL)

ssh_update_passphrase(file = ssh_home("id_rsa"))

ssh_read_key(file = ssh_home("id_rsa"), password = askpass)

Arguments

host

target host (only matters if you have configured specific keys per host)

auto_keygen

if TRUE automatically generates a key if none exists yet. Default NA is to prompt the user what to.

file

destination path of the private key. For the public key, .pub is appended to the filename.

password

a passphrase or callback function

Details

Use ssh_key_info() to find the appropriate key file on your system to connect with a given target host. In most cases this will simply be ssh_home('id_rsa') unless you have configured ssh to use specific keys for specific hosts.

To use your key to authenticate with GitHub, copy the pubkey from ssh_key_info() to your profile: https://github.com/settings/ssh/new.

If this is the first time you use ssh, ssh_keygen can help generate a key and save it in the default location. This will also automatically opens the above Github page in your browser where you can add the key to your profile.

ssh_read_key reads a private key and caches the result (in memory) for the duration of the R session. This prevents having to enter the key passphrase many times. Only use this if ssh-agent is not available (i.e. Windows)

See Also

Other credentials: http_credentials


credentials

Tools for Managing SSH and Git Credentials

v1.3.0
MIT + file LICENSE
Authors
Jeroen Ooms [aut, cre] (<https://orcid.org/0000-0002-4035-0289>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.