R/set_git_user.R

#' @title A function to easily set the git user.name and email in R
#'
#' @export

set_git_user <- function(email, username){

  system(paste("git config --global user.email", email))
  system(paste("git config --global user.name", username))

  x <- system("git config --list", intern = TRUE)

  length_email_set <- length(x[1])
  length_user_set <- length(x[2])

  if(length(length_email_set) > 0) {
    message(paste ("The email for your git account has been set to:",
                   email))
    }

  if(length(length_user_set) > 0) {
      message(paste ("The user.name for your git account has been set to:",
                     username))
    }

  }
uashogeschoolutrecht/gitr documentation built on May 24, 2019, 11:44 p.m.