1#' Credential Helpers 2#' 3#' Git supports several back-end stores for HTTPS credentials called 4#' helpers. Default helpers include `cache` and `store`, see the 5#' [git-credentials](https://git-scm.com/docs/gitcredentials) manual 6#' page for details. 7#' 8#' @export 9#' @rdname credential_helper 10#' @name credential_helper 11credential_helper_list <- function(){ 12 text <- git_with_sys(c("help", "-a")) 13 m <- gregexpr("credential-[^ \t]+", text) 14 regmatches(text, m)[[1]] 15} 16 17#' @export 18#' @rdname credential_helper 19#' @name credential_helper 20#' @param global if FALSE the setting is done per git repository, if 21#' TRUE it is in your global user git configuration. 22credential_helper_get <- function(global = FALSE){ 23 git <- find_git_cmd() 24 args <- c("config", if(global) "--global", "credential.helper") 25 git_with_sys(args) 26} 27 28#' @export 29#' @rdname credential_helper 30#' @name credential_helper 31#' @param helper string with one of the supported helpers from [credential_helper_list] 32credential_helper_set <- function(helper, global = FALSE){ 33 helper <- sub("^credential-", "", helper) 34 args <- c("config", if(global) "--global", "credential.helper", helper) 35 git_with_sys(args) 36 credential_helper_get(global = global) 37} 38