Skip to contents

Makes a repository to store code in.

Usage

create_user_repo(
  name,
  description = "This repository has been created with ghapi3",
  homepage = "https://github.com/coatless/ghapi3",
  private = FALSE,
  has_issues = TRUE,
  has_projects = TRUE,
  has_wiki = TRUE,
  auto_init = FALSE,
  gitignore_template = "R",
  license_template = "gpl-3.0",
  allow_squash_merge = TRUE,
  allow_merge_commit = TRUE,
  allow_rebase_merge = TRUE
)

create_org_repo(
  org,
  name,
  description = "This repository has been created with ghapi3",
  homepage = "https://github.com/coatless/ghapi3",
  private = FALSE,
  has_issues = TRUE,
  has_projects = TRUE,
  has_wiki = TRUE,
  team_id = NULL,
  auto_init = FALSE,
  gitignore_template = "R",
  license_template = "gpl-3.0",
  allow_squash_merge = TRUE,
  allow_merge_commit = TRUE,
  allow_rebase_merge = TRUE
)

Arguments

name

The name of the repository.

description

A short description of the repository.

homepage

A URL with more information about the repository.

private

Either `TRUE` to create a private repository or `FALSE` to create a public one. Creating private repositories requires a paid GitHub account. Default: `FALSE`.

has_issues

Either `TRUE` to enable issues for this repository or `FALSE` to disable them. Default: `TRUE`.

has_projects

Either `TRUE` to enable projects for this repository or `FALSE` to disable them. Default: `TRUE`. Note: If you're creating a repository in an organization that has disabled repository projects, the default is `FALSE`, and if you pass `TRUE`, the API returns an error.

has_wiki

Either `TRUE` to enable the wiki for this repository or `FALSE` to disable it. Default: `TRUE`.

auto_init

Pass `TRUE` to create an initial commit with empty `README`. Default: `FALSE`.

gitignore_template

Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, `"Haskell"`.

license_template

Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://help.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the `license_template` string. For example, `"mit"` or `"mpl-2.0"`. Default: `"gpl-3.0"`.

allow_squash_merge

Either `TRUE` to allow squash-merging pull requests, or `FALSE` to prevent squash-merging. Default: `TRUE`

allow_merge_commit

Either `TRUE` to allow merging pull requests with a merge commit, or `FALSE` to prevent merging pull requests with merge commits. Default: `TRUE`

allow_rebase_merge

Either `TRUE` to allow rebase-merging pull requests, or `FALSE` to prevent rebase-merging. Default: `TRUE`

org

Organization name.

team_id

The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.

References

<https://developer.github.com/v3/repos/#create>

Examples

# \donttest{
# Creates a public repository based off of username/reponame
create_user_repo("toadie")
#> Error in gh(...): GitHub API error (403): Resource not accessible by integration
#>  Read more at
#>   <https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user>

# Creates a private repository
create_user_repo("toadie", private = TRUE)
#> Error in gh(...): GitHub API error (403): Resource not accessible by integration
#>  Read more at
#>   <https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user>
# }