V3 to V4 codemods not working when Strapi in github monorepo

System Information
  • Strapi Version: V3.3.4
  • Operating System:
  • Database: Postgres
  • Node Version: 17.9.0
  • NPM Version: 6.14.4
  • Yarn Version:


I’m trying to upgrade Strapi from V3 to V4.
I’m trying to use the codemods to migrate (Step 3 from the v3-to-v4-walkthrough)
However i’m getting the following error

? What do you want to migrate? Application
? Enter the path to your Strapi application ./strapi
error: Command failed with exit code 128: git --git-dir=./strapi/.git --work-tree=./strapi status --porcelain
fatal: not a git repository: './strapi/.git'

My existing Strapi instance is part of a github monorepo, so it is not on the project root.
Is there a way for me to point to the --git-dir and --work-tree?


I have the same issue, you know how to solve it?

No solution.

We have a small customisation so will just rebuild in v4 and use api to copy over data

I just migrated to v4, and now I just want to connect my strapi v4 to PostgreSQL, I have many content types with relation fields, but after connecting with DB relation field had no data, any solution?

1、git add .
2、git commit -m ‘upgrade’
3、npx @strapi/codemods migrate