How do I restore a missing local repository from remote?

Felix Groll November 2, 2016

When I delete the main folder of my local repository (because I'm currently not working on it, and its on the same version as the remote) the SourceTree Repository Browser gives me the error message "Repository moved or deleted".

That's fine. But then my only options are to delete the Bookmark or specify another location with a version of the repository. But what if I don't have a local version and just want to continue to work on the most current, remote version?

I don't even see a possibility to get the original remote URL. So I'd have to delete the Bookmark in the SourceTree Browser, somehow retrieve the original remote URL and recreate it again as new repository... is that the only way?

1 answer

0 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 2, 2016

I cannot imagine another way ATM.

When you delete a local repository - you usually also remove the .git-folder. Within the .git-folder within the .config-file the remote URL is stored. By removing the local repository you therefore also remove the information about the original remote URL. As SourceTree does not store the remote URL internally but rather relies on the presence of the .git/.config file as source for the remote URL, deleting this file makes SourceTree acgnostic of the former remote URL.

The only way I see, is to clone your repository again and add it to SourceTree again ...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events