Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

TurboLabIt/github-mirror

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
1 Commit
 
 
 
 
 
 

Repository files navigation

Shallow-clone all your GitHub repositories to a local folder. Keep them in sync on every run.

  • Your personal repos are mirrored automatically
  • Organization repos are mirrored selectively: you choose which orgs to include on the first run, and the choice is remembered
  • Repos you delete on GitHub are moved to an archive folder, not lost
  • Authentication is handled entirely via GitHub CLI -- no SSH key or token setup required

Quick start guide

Enter the folder where you want your mirror: cd "${HOME}/backup/github-mirror".

Then:

sudo apt update && sudo apt install curl git -y && \
  curl -sL https://raw.githubusercontent.com/TurboLabIt/github-mirror/master/download.sh -o github-mirror.sh && \
  bash github-mirror.sh && rm -f github-mirror.sh

On the first run, the script will:

  1. Install the GitHub CLI (gh) if not already present
  2. Ask you to authenticate via browser
  3. Ask which organizations you want to mirror (Y/N for each)
  4. Clone everything

On subsequent runs, just re-run the same command from the same folder. No questions asked -- it updates every repo and archives any that no longer exist on GitHub.

Directory structure

your-mirror-folder/
  download.sh
  organizations.conf
  active-repositories/
    personal/
      your-repo-1/
      your-repo-2/
    YourOrg/
      org-repo-1/
      org-repo-2/
  archived-repositories/
    personal/
      deleted-repo_2025-04-12/

Changing your organization selection

Edit organizations.conf and set the value to yes or no:

MyOrg=yes
AnotherOrg=no

Delete a line entirely to be prompted again on the next run.

About

Shallow-clone all your GitHub repositories to a local folder. Keep them in sync on every run.

Resources

Stars

Watchers

Forks

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.