git_push {git4r}R Documentation

Git Push

Description

Pushes just current branch to 'origin' by default, but allows selective pushing of branches to different remotes if this is declined, for example if you want to keep a test branch private.

Usage

git_push(do_default = NULL)

Arguments

do_default

Character or logical passed as the answer to the interactive question which is "push the current branch to origin". If 'Y' or TRUE, this function runs without user input (used by git()), the default value NULL will prompt the user to answer interactively.

Details

It is enforced that when pushing to 'origin' the branch is set to track this remote branch. If the branch does not exist yet in the remote, it is not pushed by default and must be manually added.

Credentials are sorted in the same way for git_pull() and git_push(). If gitcreds package is installed, this is used first to check whether the system git installation already has a username / password for this host. This can be changed or added using stand-alone git, or gitcreds::gitcreds_set().

Alternatively, if gitcreds is not installed, a system-git is not available, or no existing git credentials are found, then the the environmental variables are searched for a suitable Personal Access Token. The variable name must begin GIT_PAT and any additional words are used to distinguish the PAT for the relevant host using a closest-string match for the remote URL, for example GIT_PAT_AZURE=abc123def456 will be chosen to authenticate an Azure DevOps remote above GIT_PAT_GITHUB or GIT_PAT_GITLAB.

To set this up from scratch by creating a Personal Access Token and saving it to your .Renviron file with the name "GIT_PAT****" where asterisks can be replaced with part of the remote URL if you need to distinguish between several different PATs (and a good reminder of what it is).

Value

Invisible NULL

See Also

git_pull, git_remote


[Package git4r version 0.1.2 Index]