Skip to content

GitBack is a command-line utility to backup GitHub Repositories, Gists & Wiki

License

Notifications You must be signed in to change notification settings

FlareXes/gitback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitBack

GitBack is a tool designed to backup GitHub repositories, wikis, and gists either with or without authentication. It provides the flexibility to backup public repositories without authentication or to backup both public and private repositories using a GitHub Personal Access Token (PAT).

Features

  • Backup repositories with or without authentication.
  • Clone repositories and their wikis if available.
  • Clone public and private gists (requires PAT).
  • Supports concurrent downloads for faster backups.

Dependencies

Installation

  1. Clone the GitBack repository:
git clone https://github.com/flarexes/gitback.git
  1. Navigate to the cloned directory:
cd gitback
  1. Build the project:
go build
  1. (Optional) Set up a GitHub Personal Access Token (PAT) if you plan to backup private repositories. Instructions can be found here.

  2. Add your GitHub Personal Access Token as environment variable:

    GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
    
    • Windows:

      • Open Control Panel and navigate to System and Security > System > Advanced system settings > Environment Variables.
      • Under System Variables, click "New" and add a variable named GITHUB_PERSONAL_ACCESS_TOKEN with your PAT as the value.
    • Linux (e.g., Ubuntu) & MacOS:

      • Open your terminal and edit the .bashrc or .zshrc file using your preferred text editor (e.g., nano, vim, gedit):
      nano ~/.bashrc
      • Add the following line at the end of the file:
      export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
      • Save the file and exit. Then, reload the shell configuration:
      source ~/.bashrc

Usage

./gitback [flags]

Flags

Flag Description Required
-noauth Disable GitHub authentication. Limits requests to 60 per hour and access to public data only. No
-username Specify the GitHub username when using -noauth. Yes (if -noauth is set)
-threads Set the maximum number of concurrent connections (default: 10). No
-token Provide the GitHub Personal Access Token directly as a flag (overrides the environment variable). No

Folder Structure

When running the tool, the following folders will be created:

  • gitback-backup_YYYY-MM-DD_HH-MM-SS/repos/: Contains cloned repositories and their wikis.
  • gitback-backup_YYYY-MM-DD_HH-MM-SS/gists/: Contains cloned gists.

Examples

Backup Public Repositories (No Authentication)

./gitback -noauth -username flarexes

Backup Private and Public Repositories (With Authentication)

./gitback

Backup with Custom Thread Limit

./gitback -threads 20

Contributing

Contributions are welcome! Please feel free to submit a pull request, I want to take this project futher.

Issues

If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.

License

This project is licensed under the BSD-3-Clause license. For more information, please see the LICENSE file.