I deleted a repository accidentally via bitbucket UI. I already had clone the project so I have it locally. When I run this command git branch --remote
, I can see all the branches on that repository. I tried git push --all origin
but I had the error fatal: remote error: Repository not found
. How can I restore my repository?
Asked
Active
Viewed 5,118 times
2

user3841581
- 2,637
- 11
- 47
- 72
-
create new repo with same name, push to the new repo. anyway, there is no way to restore the repo easily, branches you dont have locally will lost forever. cmiiw. – Bagus Tesa Dec 06 '19 at 03:24
2 Answers
1
Once you have recreated a new repository, you should:
- create local branches for all your remote tracking branches that you still have in your local repository: see "Track all remote git branches as local branches"
- change your origin to the new empty repository (unless you can re-create it with the sane name/URL)
- do a
git push --all origin
That will restore yuor repository content at the time of your last git fetch
.
-
So having only cloned the master , by re creating a git repo with all those branches will do the trick? – user3841581 Dec 06 '19 at 11:16
-
@user3841581 You are recreating an empty repository, and use your current local repo to fill it. – VonC Dec 06 '19 at 11:41
-
I am not able to push as there is a conflict in the email. This is what I received `remote: Push rejected` `remote: refs/heads/Remote-branche:45fsdsdfsdfjf: expected committer email'myemail@email' but found initialcommiter@email.com` `remote:Git filter-branch allows you to rewrite the commit history`. I know that I can override the authors of the commit but I would like to keep them – user3841581 Dec 10 '19 at 23:18