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
Project Template: ASP.NET Core Web Api Modular Monolith
Tired of doing the starting configuration again and again for new projects? Here is the solution. Use this Modular Monolith ASP.NET Core Web Api starting template and directly jump into main code.
Read Article →Achievements100 Days of Consistency: How One Line from Clean Code Changed My Learning Journey
A single sentence from Clean Code "Leave the code cleaner than you found it." inspired me to apply the same philosophy to my life. I committed to a 730-day journey of targeted learning, documenting every day's progress in a private GitHub repository. Today marks Day 100, and looking back, I can truly see how small, consistent improvements have transformed me into a better developer and a better version of myself.
Read Article →GitHow 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 →