Recreate git repository from .git folder from stash

bitbucket-server, git

Solution

Try to do a `git clone` of the .git folder

git clone file:///opt/git/project.git

If that works it will copy the Git repository.

Alternative: have you got any clients that have `git pull`ed from the Atlassian Stash server lately? You can simply use the `.git` repository of the freshest client as a new server repository.

Problem

Thanks in advance for any help. I had an instance of Atlassian Stash, with a repository on it. The instance died, and the only thing I have left, is a couple of numbered folders that seem to be the ".git" folders of a repo (i.e. with the hooks, logs, refs, objects, subfolders inside). Is there any way to recreate the repositories from these folders? If so, how? Just to clarify, I don't have the files themselves, I only have the content inside these folders. I need to recreate the versioned files from this somehow.

Original source