How to manually recover all repos from a failed server instance

Is there a way to manually copy all repositories from a server that has a failed web service? I just want to recover the repos that were managed with gitea. Gitea was running on a Ubuntu server as a snap. Any help would be appreciated!

Thanks!

Your data should be stored in $SNAP_COMMON, which for Gitea should be /var/snap/gitea/common. There should be a repositories directory which contains all of your users’ and organizations’ repositories.

Nothing special is needed to manually copy them, as they’re just stored as normal Git bare repositories which are just files and directories.

2 Likes

Awesome! Found the repos however I don’t seem to be able to see the project files in those directories and when I run a git status it says something about it needing to be in a working tree. Sorry for the lack of knowledge on how this all works. Again THANK YOU for the help!

1 Like

If they’re git files, they may be hidden since they usually start with a dot. What command are you using to peek at the directory?

After doing some brief research it looks like a bare repo doesn’t have a working directory. Thank you for your insight jake. I did the following to recover project files:

  • Create a new empty directory and CD into this new directory.
  • In a terminal clone from the local bare git repository on the local machine using:

git clone file:///path/to/bare/repo.git

  • The repo should clone over.
  • Checkout the commit-hash, branch, or tag-name to recover project files using any of the following:

git checkout commit-hash
git checkout branch-name
git checkout tag-name

Hope this helps others.