Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

:octocat:⬇️ R package: download/clone all of a user's GitHub repositories for archiving purposes

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

matt-dray/ghdump

Repository files navigation

ghdump

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.R-CMD-checkrostrum.blog post

Purpose

Clone all of a GitHub user's repositories, or download them as zip files (and optionally unzip them). Intended for archiving purposes or setting up on a new computer.

Using {ghdump}

Note that the package does what I need it to do, but is not fully tested for all systems and set-ups. Pleasefile an issue or raise a pull request if you have a problem or contribution. You can also learn more about this package froman associated blog post.

The {gitcellar} package later appeared on rOpenSci by Maëlle Salmon and Jeroen Ooms. They're very smart, so you might want to check it out. It has akeep function that allows you to select only certain repos ({ghdump} doesn't have this feature).

Install

You can install {ghdump} from GitHub with:

install.packages("remotes")# if not yet installedremotes::install_github("matt-dray/ghdump")

GitHub PAT

You'll need a GitHub Personal Access Token (PAT) to use {ghdump}.

Assuming you have a GitHub account, generate a token for accessing the GitHub API and store this in your .Renviron file. The {usethis} package helps make this a breeze. Read more in theHappy Git and GitHub for the useR book by Jenny Bryan, the STAT 545 TAs and Jim Hester.

usethis::browse_github_pat()  # opens browser to generate tokenusethis::edit_r_environ()     # add your token to the .Renviron

Make sure to restart R after these steps.

Useghd_copy()

{ghdump} has one exported function:ghd_copy(). Pass to the function a GitHub user name, a local directory to download into, and whether you want to download or clone the repos. If you want to clone, you mustspecify the protocol (make sureyour keys are set up if specifying SSH).

To clone:

ghdump::ghd_copy(gh_user="matt-dray",# user whose repos to downloaddest_dir="~/Documents/repos",# where to copy tocopy_type="clone",# 'clone' or 'download' the reposprotocol="https"# 'https' or 'ssh')

To download:

ghdump::ghd_copy(gh_user="matt-dray",dest_dir="~/Documents/repos",copy_type="download")

The function is designed to be used interactively and infrequently. To this end, the user is prompted throughout as to whether to:

  • create a new local directory with the provided 'dest_dir' argument
  • commit to cloning all the repos (ifcopy_type = "clone")
  • commit to downloading all zip files (ifcopy_type = "download") and then whether to:
    • unzip all the files
    • retain the zip files
    • rename the unzipped directories to remove the default branch suffix (e.g. '-master')

Credits

The function interacts with the GitHub API thanks tothe {gh} package by Gábor Csárdi, Jenny Bryan and Hadley Wickham. Iteration is thanks tothe {purrr} package by Lionel Henry and Hadley Wickham.The {cli} package by Gábor Csárdi allowed for a prettier user interface.

The {ghdump} package sticker was made thanks to Dmytro Perepolkin's{bunny} package and the{magick} package from Jeroen Ooms.

Code of Conduct

Please note that the {ghdump} project is released with aContributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

About

:octocat:⬇️ R package: download/clone all of a user's GitHub repositories for archiving purposes

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp