Title: | Clone Or Download All Repos For A GitHub User |
---|---|
Description: | Clone all of a GitHub user's repositories, or download them as zip files to a specified location and optionally unzip them. Intended for archiving or setting up a new computer. |
Authors: | Matt Dray [aut, cre] |
Maintainer: | Matt Dray <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-12 02:39:17 UTC |
Source: | https://github.com/matt-dray/ghdump |
Iterate over multiple repos for a given GitHub user, cloning them to a specified local repository.
ghd_clone_multi(gh_user, names_vec, protocol, dest_dir)
ghd_clone_multi(gh_user, names_vec, protocol, dest_dir)
gh_user |
Character string. A GitHub user name. |
names_vec |
Character vector. Repo names for the given |
protocol |
Character string. Either |
dest_dir |
Character string. A local file path where the zipped repositories will be downloaded to. Must be a full path. |
If you're using protocol = "ssh"
, you need to make sure
you've set up your SSH keys.
The named user's named repos cloned to the specified location.
Clone a repo for a specified user to a specified local repository.
ghd_clone_one(gh_user, repo, protocol, dest_dir)
ghd_clone_one(gh_user, repo, protocol, dest_dir)
gh_user |
Character string. A GitHub user name. |
repo |
Character string. A GitHub repo name for the named |
protocol |
Character string. Either |
dest_dir |
Character string. A local file path where the zipped repositories will be downloaded to. Must be a full path. |
If you're using protocol = "ssh"
, you need to make sure you have
set up your SSH keys.
If you're using protocol = "ssh"
, you need to make sure
you've set up your SSH keys.
The named user's named repo cloned to the specified location.
Clone all of a GitHub user's repositories to your computer, or download them all as zip files and then optionally unzip them.
ghd_copy(gh_user, dest_dir, copy_type, protocol = NULL)
ghd_copy(gh_user, dest_dir, copy_type, protocol = NULL)
gh_user |
Character string. A GitHub user name. |
dest_dir |
Character string. A local file path where the clones or zipped repositories will be downloaded to. Must be a full path. |
copy_type |
Character string. Specify whether to |
protocol |
Character string. Either |
Make sure you've got a GitHub account and have
generated a GitHub PAT
and stored it your .Renviron. If you're using protocol = "ssh"
,
you need to make sure you have
set up your SSH keys.
GitHub repositories either (a) cloned or (b) downloaded in the specified local directory.
## Not run: ghd_copy( gh_user = "matt-dray", dest_dir = "~/Documents/repos-cloned", copy_type = "clone", protocol = "https" ) ghd_copy( gh_user = "matt-dray", dest_dir = "~/Documents/repos-downloaded", copy_type = "download" ) ## End(Not run)
## Not run: ghd_copy( gh_user = "matt-dray", dest_dir = "~/Documents/repos-cloned", copy_type = "clone", protocol = "https" ) ghd_copy( gh_user = "matt-dray", dest_dir = "~/Documents/repos-downloaded", copy_type = "download" ) ## End(Not run)
Download to a specified location the zip files from provided URL. The directory is created if it doesn't already exist.
ghd_download_zips(repo_urls, dest_dir)
ghd_download_zips(repo_urls, dest_dir)
repo_urls |
A data.frame as returned by
|
dest_dir |
A character string. The local directory you want to download the zipped files to. Must be a full path. |
Zipped GitHub repositories downloaded to a (possibly new) directory.
Prepare a data frame containing each repo name and its corresponding zip file URL in the form https://github.com/username/reponame/archive/master.zip
ghd_enframe_urls(repo_names, gh_user)
ghd_enframe_urls(repo_names, gh_user)
repo_names |
A character vector of GitHub repository names, as returned
by |
gh_user |
The name of a GitHub user. |
A data.frame object. One row per GitHub repo with character vector columns for the repo_names and zip_url.
Extract all the 'name' elements from a gh_response object. These are the names of all the GitHub repos.
ghd_extract_names(repo_object)
ghd_extract_names(repo_object)
repo_object |
A gh_response object, as returned by
|
A character vector of GitHub repo names.
Uses gh
to access the GitHub API and get the details for
all of a named user's repos. To use this function you need to have created a
GitHub account and to have put a GitHub Personal Access Token (PAT) in your
.Renviron. See
Happy Git and GitHub for the UseR
for more information.
ghd_get_repos(gh_user)
ghd_get_repos(gh_user)
gh_user |
Character string. A GitHub username. |
A gh_response (list) object.
Unzips the GitHub repositories that have been downloaded to a specified local directory and optionally deletes the zipped versions. Optionally rename all the unzipped folders to remove the "-master" suffix (e.g. "demo-repo-master" becomes "demo-repo").
ghd_unzip(dir)
ghd_unzip(dir)
dir |
A string. Path to a local directory containing zipped GitHub
directories. These may have been downloaded using
|
Unzipped GitHub repositories in a named directory.