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<OWNER>/<REPO>.git

    • protocol = "https" implies<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")




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.


"ssh" or "https"


if (FALSE) { ## consult the option and maybe get an interactive menu git_protocol() ## explicitly set the protocol use_git_protocol("ssh") use_git_protocol("https") }