cred_token: Create a new personal access token credential object

Description Usage Arguments Value See Also Examples

View source: R/credential.R

Description

The personal access token is stored in an envrionmental variable. Environmental variables can be written to the file .Renviron. This file is read by R during startup, see Startup. On GitHub, personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for Git over HTTPS, see https://help.github.com/articles/creating-an-access-token-for-command-line-use

Usage

1
cred_token(token = "GITHUB_PAT")

Arguments

token

The name of the environmental variable that holds the personal access token for the authentication. Default is GITHUB_PAT.

Value

A list of class cred_token with entry:

token

The name of the environmental variable that holds the personal access token for the authentication.

See Also

Other git credential functions: cred_env(), cred_ssh_key(), cred_user_pass()

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
## Create a personal access token credential object.
## This example assumes that the token is stored in
## the 'GITHUB_PAT' environmental variable.
repo <- repository("git2r")
cred <- cred_token()
push(repo, credentials = cred)

## End(Not run)

git2r documentation built on Nov. 22, 2021, 9:08 a.m.

Related to cred_token in git2r...