Skip to content

Downloader and updater for your github repos

License

Notifications You must be signed in to change notification settings

dbnicholson/gh_fetch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh_fetch

###Downloader and updater for your github repos.

  • Did you ever needed to keep a backup of a large number of GitHub repos?
  • Did you ever need to start using your dev machine quickly but had to clone repos one by one?
  • Did you ever need to update (fetch) a ton of repositories from GitHub but you had to do it one by one?

gh_fetch is designed to fix all of these problems by automating the process to the maximum extent possible. This tool will go through your (or another account's) GitHub repos both public and private including repositories from organizations you are a member of and fetch the most recent changes for it, cloning the relevant repos if they are not already downloaded. Feature set will be expanding per my current needs but you are free to fork and issue a pull request.

$ ./update_repos -h
usage: update_repos [-h] [--version] [-d DIRECTORY] [-t TOKEN_FILE] [-s] [-m]
                    [-x] [--exclude-forks] [--exclude-orgs]
                    [--include-org-forks] [--include-public-org-repos]
                    [--full-backup] [--debug]
                    username [token]

Retrieve and/or update local copies of GitHub-hosted repos

positional arguments:
  username              GitHub username that will be used for cloning and
                        fetching
  token                 GitHub auth token for that username. You can create
                        one at https://github.com/settings/applications

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -d DIRECTORY, --directory DIRECTORY
                        Target directory for cloning and fetching
  -t TOKEN_FILE, --token-file TOKEN_FILE
                        File containing the github token
  -s, --ssh             Fetch repositories using ssh
  -m, --mirror          Mirror bare repositories instead of making full
                        checkouts
  -x, --exclude-own     Exclude own repositories in the updates
  --exclude-forks       Exclude forked repositories from the updates
  --exclude-orgs        Exclude repos that are in user's orgs (this does not
                        filter the ones you have)
  --include-org-forks   Include forked repos that are in user's orgs
  --include-public-org-repos
                        Include public repos that are in user's orgs
  --full-backup         Include all repository content
  --debug               Enable debugging output

Examples

  • Getting all your repos:
./update_repos -d /opt/checkout --exclude-orgs sgnn7 1234567890abfdefghijkl
  • Backing up all organizational repos:
./update_repos -x -d ~/backups --include-org-forks --include-public-org-repos backup-user 1234567890abfdefghijkl

TODO:

  • Scrubbing of remote endpoints
  • Lots of testing

About

Downloader and updater for your github repos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.8%
  • Shell 1.2%