🔒 Don’t Let a GitHub Suspension Kill Your Projects – Keep Multiple Backups of Your Code
Recently, my GitHub account was suspended. My projects, all my repos, and every commit were gone in a second.
That’s when it hit me: as developers, we trust GitHub (or any single platform) way too much. If your account gets suspended, hacked, or if the platform goes down, all your hard work could vanish.
This is a practical guide on how to keep multiple copies of your code in different places—the way professionals do.
🚨 Why Multiple Backups Matter for Devs
- Suspension risk – Platforms like GitHub, GitLab, and Bitbucket can suspend accounts.
- Outages happen – Even the biggest platforms can go down.
- Hacks and data loss – Security breaches or accidental deletions happen.
- Peace of mind – Having multiple copies means you’ll never lose your code.
Think of it like this:
Code is the heart of your dev journey—don't keep it in just one box.
🔹 1. Push to Multiple Git Remotes
Git makes this easy: you can push to more than one host.
Example: Same Repo, Different Remotes
# Clone your repo
git clone https://github.com/username/myproject.git
cd myproject
# Add GitLab as another remote
git remote add gitlab https://gitlab.com/username/myproject.git
git push --all gitlab
# Add Bitbucket too
git remote add bitbucket https://bitbucket.org/username/myproject.git
git push --all bitbucket
Now your code lives on GitHub + GitLab + Bitbucket. If one fails, the others have your back.
🔹 2. Mirror Clone for Local Backups
A normal clone isn’t enough. Use a mirror clone to grab everything: branches, tags, and refs.
git clone --mirror https://github.com/username/myproject.git
This gives you a perfect local copy. Keep it on your machine or an external drive for an extra layer of protection.
🔹 3. Cloud Storage (Google Drive, Dropbox, OneDrive)
This method isn’t fancy, but it is reliable. Just zip your project and upload it to the cloud.
zip -r myproject-backup.zip myproject/
Upload that .zip
to Google Drive, Dropbox, OneDrive, or Mega.
🔑 Pro tip: Automate this process so you don’t forget to do it.
🔹 4. Self-Host Your Git
Want total control? Run your own Git server.
This is a perfect option if you have a home server, a VPS, or just like being independent.
🔹 5. Automate Backups with a Script
Doing this by hand is painful. It’s better to automate it.
Example: Bash Script (Linux/Mac)
#!/bin/bash
BACKUP_DIR="$HOME/git-backups"
DATE=$(date +%F)
mkdir -p "$BACKUP_DIR/$DATE"
repos=(
"https://github.com/username/repo1.git"
"https://github.com/username/repo2.git"
)
for repo in "${repos[@]}"; do
name=$(basename "$repo" .git)
git clone --mirror "$repo" "$BACKUP_DIR/$DATE/$name"
done
cd "$BACKUP_DIR"
zip -r "git-backup-$DATE.zip" "$DATE"
Run it with cron (Linux/Mac) or Task Scheduler (Windows).
🔹 6. Automate Backups with PowerShell (Windows)
For Windows devs, here’s a PowerShell script that mirrors your repos and zips them.
# Git Backup Script for Windows
$backupDir = "$HOME\git-backups"
$date = Get-Date -Format "yyyy-MM-dd"
$todayDir = Join-Path $backupDir $date
# Create backup folder
New-Item -ItemType Directory -Force -Path $todayDir | Out-Null
# List of repos
$repos = @(
"https://github.com/username/repo1.git",
"https://github.com/username/repo2.git"
)
foreach ($repo in $repos) {
$name = ($repo.Split("/")[-1]).Replace(".git", "")
git clone --mirror $repo "$todayDir\$name"
}
# Create a zip archive
$zipFile = "$backupDir\git-backup-$date.zip"
Compress-Archive -Path $todayDir -DestinationPath $zipFile -Force
Save it as backup.ps1
and run it manually, or schedule it with Task Scheduler for daily or weekly backups.
✅ Best Practices for Devs
- Keep three copies minimum: a local machine copy, one on cloud storage, and one on another Git host.
- Test restores—backups are useless if you can’t recover them.
- Use SSH keys for smooth multi-remote pushes.
- Automate—you should never rely on your memory for backups.
🎯 Final Thoughts
Your code is your craft. Losing it hurts—trust me, I learned the hard way.
Don’t put all your trust in one platform. Distribute, mirror, and back it up.
The next time GitHub, GitLab, or Bitbucket fails, you’ll smile and say:
“No worries, I’ve got backups.”
Over to you:
Where do you keep your backups? Do you trust GitHub 100%, or do you mirror to GitLab or Bitbucket too?
Top comments (6)
What I do is to add multiple pushurls to my origin remote. This way
git push
automatically pushes to all of them. Also take a look at soft-serve for a really lightweight git server.yes u are right but what if your Github account banned or sespened u are unable to push code on github and unable to recover all code thats u push on git server some case they banned ur account then ur all code waste in case u have not backup of ur code and drive cruppt or any case then all ur work lost just told u in short take back up of ur code for saftey and if git add soon new feature we able to get backup again even after our account suspend so we not need it thats
I currently push everything to github, gitlab, bitbucket, pierre and my own soft-serve using pushurls. If any of these should go away there are still four left...
Yes good right
Thank you for sharing this article.
I found it really helpful and practical.
Since I only use GitHub and don't have any backups elsewhere, I'll definitely try out some of these methods.
ur welcome sure