Home > other >  Strapi how to handle git conflict when media uploaded to Strapi from prod
Strapi how to handle git conflict when media uploaded to Strapi from prod

Time:12-29

I have a question about Strapi before start using it but couldn't find a answer.

Strapi cms makes changes on files after certain edits or when uploaded a media(adds media to folder).

Lets say I setted up Strapi and published it to production, on production when someone very normally uploads/changes a media and it creates those files in file system and of course shows up if you run git status in prod server.

So after that when I need to add something to dev branch and then when updating the prod it will have a conflict when I try to merge dev branch to prod. Commiting those images on prod and pulling all those to local are not logical. Am I not seeing something here that resolves this ? If only option is to use other media storage services then why even Strapi added something like this ?

CodePudding user response:

first off, it's not recommended to share environments (e.g. share database or media folder). However we all pretty much doing this.

So usually the public/uploads folder is added to .gitignore if it isn't for you seems someone removed it manually. There is also option to place uploads folder outside of directory:

// path: ./config/server.js
module.exports = ({ env }) => ({
  ...
  dirs: {
    public: '/var/storage/...`
  }
})

I can recommend:

  1. Add public/uploads folder to .gitignore
  2. Fix issue wit tracked files link
  • Related