Tools for Managing SSH and Git Credentials
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst
man
vignettes
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION
LICENSE
LICENSE.md
NAMESPACE
README.md
appveyor.yml
credentials.Rproj

README.md

credentials

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status AppVeyor Build Status CRAN_Status_Badge CRAN RStudio mirror downloads

Tools for Managing SSH and Git Credentials

Setup and retrieve HTTPS and SSH credentials for use with 'git' and other services. For HTTPS remotes the package interfaces the 'git-credential' utility which 'git' uses to store HTTP usernames and passwords. For SSH remotes we provide convenient functions to find or generate appropriate SSH keys. The package both helps the user to setup a local git installation, and also provides a back-end for git/ssh client libraries to authenticate with existing user credentials.

You can install the latest version from Github:

remotes::install_github("r-lib/credentials")

Setting your GITHUB_PAT

Automatically populate your GITHUB_PAT environment variable from the native git credential store. The credential manager will safely prompt the user for credentials when needed.

credentials::set_github_pat()

Use this function in your .Rprofile if you want to automatically set GITHUB_PAT for each R session, without hardcoding your any secrets in plain text.

Manage HTTPS credentials

Load or prompt the user for GitHub username and password:

library(credentials)
git_credential_ask('https://github.com')

See which credential helper back-end your git-credential store is using:

credentials::credential_helper_get()

Manage SSH keys

Lookup the appropriate key, or prompt the user to generate one:

library(credentials)
ssh_key_info()

You can copy-paste the public key directly to your GitHub profile!

For developers

Use the openssl package to read the user private key in R for encryption / signatures:

user <- ssh_key_info()
key <- ssh_read_key(user$key)
openssl::write_pem(key)