How to Restore a Deleted GitHub Repository
Accidentally deleted a GitHub repository? Donot panic. In many cases, you can restore it directly from GitHub.

Accidentally deleted a GitHub repository? Don't panic. In many cases, you can restore it directly from GitHub.
GitHub generally allows eligible deleted repositories to be restored within 90 days of deletion.
1. Sign in to GitHub
Go to GitHub and sign in to the account that owned the deleted repository.
2. Open Settings
Click your profile picture in the top-right corner and select Settings.
3. Go to Repositories
In the left sidebar, find Code, planning, and automation and select Repositories.
4. Open Deleted Repositories
Look for the Deleted repositories section.
GitHub will show repositories that are currently available for restoration.
5. Find Your Repository
Find the repository you accidentally deleted.
For example:
Deleted repositories
my-project
website-api
my-awesome-app
Restore
Click Restore next to the repository you want to recover.
6. Confirm the Restoration
GitHub will show a confirmation message.
Click:
I understand, restore this repository
Your repository should now be restored.
What If You Just Deleted It?
If you deleted the repository very recently and don't see it in the list, wait up to one hour and check again.
What Gets Restored?
GitHub can restore the repository and its contents, but some settings may need to be configured again.
For example:
- Team permissions may need to be restored.
- Some repository settings may need to be checked.
- Verify branches and other important repository features after restoration.
What If the Repository Is Not Available for Restoration?
If the repository is older than the normal 90-day restoration window, GitHub may no longer be able to restore it.
If you have a local clone, however, you may still be able to recover the Git history.
Check your local repository:
cd my-project
git log --oneline
git branch -a
git remote -v
If your .git directory is intact, your commits and branches may still be available locally.
You can create a new GitHub repository and push your local repository to it:
git remote remove origin
git remote add origin https://github.com/YOUR-USERNAME/NEW-REPOSITORY.git
git push -u origin --all
git push origin --tags
Important: Back Up Your Repositories
To avoid losing your repository in the future, consider keeping a mirror backup:
git clone --mirror https://github.com/USERNAME/REPOSITORY.git
A mirror clone preserves Git references and history and can be useful for disaster recovery.
Quick Checklist
- Sign in to GitHub
- Open Settings → Repositories
- Open Deleted repositories
- Find your repository
- Click Restore
- Confirm the restoration
- Verify your files and Git history
- Check permissions and repository settings
- Create a backup
Final Tip
If you accidentally deleted a repository, don't immediately create a new repository with the same name. First check GitHub's Deleted repositories section and see whether the original repository can be restored.
For more details, see the official GitHub documentation.
Share this article

Dabananda Mitra
Software Engineer specializing in scalable backend systems and minimal, effective API design.
Comments
Loading comments...
More Writings
How to Rename a Git Commit (Even After Pushing)
Learn how to rename the latest or an older Git commit using git commit --amend and interactive rebase. This guide also explains when and why to use git push --force-with-lease.
Read Article →WindowsHow to Kill a Process Using Port in Windows: Complete Guide
Learn how to find and kill a process using a specific port in Windows with netstat, tasklist, and taskkill commands. A practical guide for .NET and ASP.NET Core developers.
Read Article →.NETTop 500 .NET Interview Questions | Complete Preparation Guide
Preparing for a .NET developer interview? I collected 500 unique interview questions covering the most important areas of the .NET ecosystem. This is a useful revision resource for freshers and experienced .NET developers preparing for technical interviews. Save it, practice the questions category by category, and use it as a structured roadmap for your .NET interview preparation.
Read Article →