repo2github: Upload a Local Repo to GitHub

View source: R/repo2github.R

repo2githubR Documentation

Upload a Local Repo to GitHub

Description

Allows uploading a local repository to GitHub without first creating the repository in the clouds. repo2github is designed for the initial push to GitHub. Future pushes can be handled via RStudio or other Git interface.

Usage

repo2github(
  password,
  project.dir = getwd(),
  repo = basename(getwd()),
  github.user = getOption("github.user"),
  gitpath = NULL,
  readme = TRUE
)

Arguments

password

GitHub user password (character string). If this is not supplied the user will be prompted to enter a password.

project.dir

The path to the root directory of the report/presentation.

repo

A character string naming the repo; default attempts to use the report project directory name.

github.user

GitHub user name (character string).

gitpath

Path to the location of Git. If NULL repo2github will attempt to locate the path if necessary.

readme

logical. If TRUE repo initializes with a README.md file.

Details

The arguments project.dir and repo use getwd. This assumes is the current working directory is the root directory and is done for convenience. The user should ensure that either their working directory is the root directory or supply the correct root directory/name to these arguments.

Value

Creates GitHub repository.

Warning

For Windows users this function creates a temporary _netrc file in the home directory and attempts to delete this file. The _netrc contains username and password information for GitHub. repo2github attempts to delete this file but care should be taken. The file is created in:
file.path(Sys.getenv()["HOME"], "DELETE_ME_REPORTS_PACKAGE/_nectrc").

Suggestion

The user may want to set options for github.user in the user's primary .Rprofile.

Note

The user will need to have a GitHub account established.

Author(s)

Simon O'Hanlon, Daniel Chaffiol, and Tyler Rinker <tyler.rinker@gmail.com>

References

https://stackoverflow.com/a/15047013/1000343
https://stackoverflow.com/a/18692400/1000343

Examples

## Not run: 
repo2github()

## End(Not run)

qdapTools documentation built on May 31, 2023, 7:01 p.m.