The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Github::Backup - Back up your Github repositories and/or issues locally

Coverage Status


    github_backup \
        --user stevieb9 \
        --token 003e12e0780025889f8da286d89d144323c20c1ff7 \
        --dir /home/steve/github_backup \
        --repos \

    # You can store the token in an environment variable as opposed to sending
    # it on the command line

    export GITHUB_TOKEN=003e12e0780025889f8da286d89d144323c20c1ff7

    github_backup -u stevieb9 -d ~/github_backup -r


The cloud is a wonderful thing, but things do happen. Use this distribution to back up all of your Github repositories and/or issues to your local machine for both assurance of data accessibility due to outage, data loss, or just simply off-line use.


-u | --user

Mandatory: Your Github username.

-t | --token

Mandatory: Your Github API token. If you wish to not include this on the command line, you can put the token into the GITHUB_TOKEN environment variable.

-l | --list

Optional: Simply prints a list of all available repositories for the specified user.

-d | --dir

Mandatory (if using --repos or --issues): The backup directory where your repositories and/or issues will be stored. The format of the directory structure will be as follows:

        - issues/
            - repo1/
                - open
                    - issue_id_x
                - closed
                    - issue_id_y
            - repo2/
                - open
                    - issue_id_a
        - repo1/
            - repository data
        - repo2/
            - repository data

The repositories are stored as found on Github. The issues are stored in JSON format.

-r | --repos

Optional: Back up all of your repositories found on Github.

Note that either --repos or --issues must be sent in.

-i | --issues

Optional: Back up all of your issues across all of your Github repositories. This includes both open and closed issues.

Note that either --issues or --repos must be sent in.

-p | --proxy

Optional: Send in a proxy in the format and we'll use this to do our fetching.

-h | --help

Display the usage information page.



Instantiates and returns a new Github::Backup object.



Mandatory, String: Your Github username.


Mandatory, String: Your Github API token. Note that if you do not wish to store this in code, you can put it into the GITHUB_TOKEN environment variable, and we'll read it in from there instead.


Mandatory, String: The directory that you wish to store your downloaded Github information to.


Optional, String: Send in a proxy in the format and we'll use this to do our fetching.


Optional, Bool. Used only for testing. Tells DESTROY to remove the backup directory.


Optional, Integer: Sets the number of repositories we'll operate on. Used primarily for testing.

Default: Unlimited.


Takes no parameters. Returns a list of all repository objects as returned from Pithub / the Github API.

Common fields are $repo-{name}>, $repo-{clone_url}> etc.


Takes no parameters. Backs up all of your Github repositories, and stores them in the specified backup directory.


Takes no parameters. Backs up all of your Github issues. Stores them per-repo within the /backup_dir/issues directory. Structure of the issues directory is as follows:

        - issues/
            - repo/
                - open/
                    - issue_x
                - closed/
                    - issue_y
            - repo2/
                - open/
                - closed/


Takes no parameters. Normally, we copy the staging backup directory to the actual backup directory at the time we destroy the object. Call this method to set up the backup directory immediately.


- Slowly, I will add new functionality such as backing up *all* Github data, as well as provide the ability to restore to Github the various items.

- Add more tests. Usually I don't release a distribution with such few tests, but in this case I have. I digress.


Steve Bertrand, <steveb at>


Copyright 2017,2018 Steve Bertrand.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.