Just a very quick update about how I was able to restore a git repository stored inside a Gitea and backed up via restic.
Warning: this guide most probably does not work correctly with LFS files, but they might either not be that critical to restore or the repository might not even use LFS in the first place.
Restore the bare repository:
restic --repo path/to/repository restore latest --target restored --include /path/to/gitea/data/git/repositories/peter.babic/MY-REPOSITORY.git
Copy the repository here and step into it:
cp -r restored/path/to/gitea/data/git/repositories/peter.babic/MY-REPOSITORY.git .
cd MY-REPOSITORY.git
Create a .git
folder inside:
mkdir .git
Move everything into that folder (assuming zsh
):
setopt extendedglob
mv ^.git .git
unsetopt extendedglob
Reset index, as everything will show up as deleted and staged:
git reset --hard
Optionally, fix origin:
Edit
.git/config
file adding linefetch = +refs/heads/*:refs/remotes/origin/*
afterurl = <...>
in[remote "origin"]
section.
Enjoy!