usethis (version 1.5.1)

git_protocol: Produce or register git protocol

Description

Git operations that address a remote use a so-called "transport protocol". usethis supports SSH and HTTPS. The protocol affects two things:

  • The default URL format for repos with no existing remote protocol:

    • protocol = "ssh" implies git@github.com:<OWNER>/<REPO>.git

    • protocol = "https" implies https://github.com/<OWNER>/<REPO>.git

  • The strategy for creating credentials when none are given. See git_credentials() for details. Two helper functions are available:

  • git_protocol() returns the user's preferred protocol, if known, and, otherwise, asks the user (interactive session) or defaults to SSH (non-interactive session).

  • use_git_protocol() allows the user to set the git protocol, which is stored in the usethis.protocol option. Any interactive choice re: protocol comes with a reminder of how to set the protocol at startup by setting an option in .Rprofile:

options(usethis.protocol = "ssh")
## or
options(usethis.protocol = "https")

Usage

git_protocol()

use_git_protocol(protocol)

Arguments

protocol

Optional. Should be "ssh" or "https", if specified. Defaults to the option usethis.protocol and, if unset, to an interactive choice or, in non-interactive sessions, "ssh". NA triggers the interactive menu.

Value

"ssh" or "https"

Examples

Run this code
# NOT RUN {
## consult the option and maybe get an interactive menu
git_protocol()

## explicitly set the protocol
use_git_protocol("ssh")
use_git_protocol("https")
# }

Run the code above in your browser using DataLab