Unable to push to remote after full recovery

I had to reinstall my gitea container from scratch, and I took advantage of it to update my gitea version to the latest.
In order to recover all my repositories I re created all the repos by hand from the web UI and then I just copied pasted all my git folders into the gitea/git/repositories/user volume. So far, so good, I can access my repos from the web site.
However things got complicated when I tried to push some commits on the origin from my local repo.
I got those kind of error:
! [remote rejected] master -> master (unable to migrate objects to permanent storage)

When I create a new repo from scratch on the website and then pull it works like a charm. So I suppose there is a link broken somehow between my git folders I copy pasted and the db entries.
Do you have any ideas on how to fix this?