git2r (version 0.10.1)

remote_url: Get the remote url for remotes in a repo

Description

Get the remote url for remotes in a repo

Usage

remote_url(repo, remote = remotes(repo))

## S3 method for class 'git_repository': remote_url(repo, remote = remotes(repo))

Arguments

repo
The repository to get remote urls from
remote
Character vector with the remotes to get the url from. Default is the remotes of the repository.

Value

  • Character vector with remote_url for each of the remote

Examples

Run this code
## 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)

Run the code above in your browser using DataCamp Workspace