Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

git_protocol

See or set the default Git protocol


Description

Git operations that address a remote use a so-called "transport protocol". usethis supports HTTPS and SSH. The protocol dictates the Git URL format used when usethis needs to configure the first GitHub remote for a repo:

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

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

Two helper functions are available:

  • git_protocol() reveals the protocol "in force". As of usethis v2.0.0, this defaults to "https". You can change this for the duration of the R session with use_git_protocol(). Change the default for all R sessions with code like this in your .Rprofile (easily editable via edit_r_profile()):

    options(usethis.protocol = "ssh")
    
  • use_git_protocol() sets the Git protocol for the current R session

This protocol only affects the Git URL for newly configured remotes. All existing Git remote URLs are always respected, whether HTTPS or SSH.

Usage

git_protocol()

use_git_protocol(protocol)

Arguments

protocol

One of "https" or "ssh"

Value

The protocol, either "https" or "ssh"

Examples

## Not run: 
git_protocol()

use_git_protocol("ssh")
git_protocol()

use_git_protocol("https")
git_protocol()

## End(Not run)

usethis

Automate Package and Project Setup

v2.0.1
MIT + file LICENSE
Authors
Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Jennifer Bryan [aut, cre] (<https://orcid.org/0000-0002-6983-2759>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.