Add a remote to a repo

Share:

Description

Add a remote to a repo

Usage

1
2
3
4
remote_add(repo, name, url)

## S4 method for signature 'git_repository,character,character'
remote_add(repo, name, url)

Arguments

repo

The repository to add the remote to

name

Short name of the remote repository

url

URL of the remote repository

Value

NULL, invisibly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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")

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

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.