Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save a2sc/3056d5918f86fce6a452b045ab68ea1f to your computer and use it in GitHub Desktop.
Save a2sc/3056d5918f86fce6a452b045ab68ea1f to your computer and use it in GitHub Desktop.
Github Desktop App: How to restore from your local repository an accidentaly deleted remote repository on Github

If you accidentally delete your remote repository on Github, which is really stupid, but it happened to me once, despite the requested confirmations... you will have errors when trying to push from the Github Desktop App!

Here is the very simple procedure to follow:

  1. Create a new repository on Github from your account with the same name as your previous repository. IMPORTANT: Make sure to not initialize the repository with a README, .gitignore, or license since you already have files locally that you want to push.

  2. In the terminal, navigate to your local repository's directory:

git remote set-url origin https://github.com/your-username/your-repository.git
git remote remove origin
git remote add origin https://github.com/your-username/your-repository.git
  1. Now, from the Github Desktop App or from the terminal, just push your local repository to the new remote repository…

That’it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment