remote_add: Add a remote to a repo

View source: R/remote.R

remote_addR Documentation

Add a remote to a repo

Description

Add a remote to a repo

Usage

remote_add(repo = ".", name = NULL, url = NULL)

Arguments

repo

a path to a repository or a git_repository object. Default is '.'

name

Short name of the remote repository

url

URL of the remote repository

Value

NULL, invisibly

Examples

## Not run: 
## Initialize a temporary repository
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)

## Create a user and commit a file
config(repo, user.name="Alice", user.email="alice@example.org")
writeLines("Hello world!", file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "First commit message")

## Add a remote
remote_add(repo, "playground", "https://example.org/git2r/playground")
remotes(repo)
remote_url(repo, "playground")

## Rename a remote
remote_rename(repo, "playground", "foobar")
remotes(repo)
remote_url(repo, "foobar")

## Set remote url
remote_set_url(repo, "foobar", "https://example.org/git2r/foobar")
remotes(repo)
remote_url(repo, "foobar")

## Remove a remote
remote_remove(repo, "foobar")
remotes(repo)

## End(Not run)

git2r documentation built on Oct. 21, 2024, 1:06 a.m.

Related to remote_add in git2r...