Giter Site home page Giter Site logo

github-archive's Introduction

GitHub Archive

Powerful script to clone your entire GitHub instance or save it as an archive.

Build Status MIT Licence

What Can it Do?

  • Clone/pull personal repos (public and private)
  • Clone/pull organization repos (public and private)
  • Clone/pull personal gists (public and private)
  • Iterate over 100's of repos and gists
  • Can be configured to run on a schedule to automate pulling changes

Configurable Settings

The power of GitHub Archive comes in its configuration. Maybe you only want to clone/pull your personal public repos or maybe you want to go all out and include private repos from you and all organizations you belong to including your gists. Customize the location repos are saved to, how long logs are kept for and the naming format they'll use. Iterate over 100's of repos and sit back while GitHub Archive does all the work.

  • Personal repos (on/off)
  • Organization repos (on/off)
  • Personal Gists (on/off)
  • Cloning (on/off)
  • Pulling (on/off)
  • Specify the number of repos to include (1 - โˆž)
  • Log retention life & filename scheme
  • GitHub Archive location
  • Which branch to pull from

Install

NOTE: This project requires that you have Python installed. Python usually comes built-in on macOS and Linux.

# Copy the configuration file and edit for your needs.
cp .config.example .config

For Private Repos: You must have an SSH key generated on your local machine and added to your GitHub account.

Automating SSH Passphrase Prompt (Recommended)

To allow the script to run continuosly without requiring your SSH passphrase, you'll need to add your passphrase to the SSH agent. NOTE: Your SSH passphrase will be unloaded upon logout.

# This assumes you've saved your SSH keys to the default location
ssh-add

Usage

GitHub Archive will clone any repo and gist that doesn't exist locally and pull those that do from the master branch of each repo and latest revision of each gist that you have access to - including organizations (if configured). You can run the script once, add an alias, or have it setup with a cron or Launch Agent and run occasionally to clone/pull any changes since it was last run.

Merge Conflicts: Be aware that using GitHub Archive could lead to merge conflicts if you continually pull the same repos you work on without stashing or committing your changes. It is recommended to be used once for example on a new machine or setup as a separate archive from your development repositories. If you use GitHub Archive to pull in nighly changes from various repos, you should be religious about stashing or committing your changes or you will receive merge conflicts and the script may not complete running.

Run Script

./github-archive.sh

Shell Alias

# If using Bash insted of ZSH, use ~/.bash_profile
echo alias github-archive="/path/to/github-archive.sh" >> ~/.zshrc
source ~/.zshrc

# Usage of alias
github-archive

Launch Agent (Recommended on macOS)

Edit the path in the plist file to your script and logs as well as the time to execute, then setup the Launch Agent:

# Copy the plist to the Launch Agent directory
cp local.githubArchive.plist ~/Library/LaunchAgents

# Use `load/unload` to add/remove the script as a Launch Agent
launchctl load ~/Library/LaunchAgents/local.githubArchive.plist

# To `start/stop` the script from running, use the following
launchctl start local.githubArchive.plist

Cron

crontab -e

0 1 * * * /path/to/github-archive.sh

github-archive's People

Contributors

justintime50 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.