Skip to content

Python script allows you to backup all your GitHub repositories (both public and private) by cloning them to your local machine.

Notifications You must be signed in to change notification settings

psparwez/github-backup-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Backup Script

This Python script allows you to backup all your GitHub repositories (both public and private) by cloning them to your local machine.

Features

  • Clones repositories: Clones all repositories from your GitHub account (public, private, or both).
  • Fork management: Optionally include forked repositories.
  • Customization: Allows you to select whether to clone public, private, or both types of repositories.

Installation

  1. Clone the repository:

     git clone https://github.com/psparwez/github-backup-script.git
     cd github-backup-script
  2. Create a virtual environment:

    • For Windows:
       python -m venv .venv
       .\.venv\Scripts\activate
    • For macOS/Linux:
     python3 -m venv .venv
     source .venv/bin/activate
  3. Install the dependencies:

     pip install -r requirements.txt

Step 4: Set Your GitHub Personal Access Token

You need to generate a GitHub Personal Access Token (PAT) with the repo scope to access private repositories.

In the main.py script, replace the GITHUB_TOKEN variable with your actual GitHub token:

GITHUB_TOKEN = 'your_github_token' # Replace with your GitHub token

Step 5: Run the Script

Execute the script by running the following command:

python main.py

Example

? Do you want to clone forked repositories as well? No
? Which type of repositories do you want to clone? public
Fetching your repositories...
Found repo: demo (Public)
Found repo: test (Public)
Do you want to proceed with cloning these repositories? Yes
Cloning repository: demo...
Cloning repository: test...
Successfully cloned: demo
Successfully cloned: test

About

Python script allows you to backup all your GitHub repositories (both public and private) by cloning them to your local machine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages