I know similar questions have been asked multiple times, but I cannot get it to work for my case.
Where I am: I have a local repo that I push to a live server, that included a /content folder and its subfolders. During production that was okay, since I could make changes to /content and just push them. But since this is a website using a CMS all changes to /content will now be produced remotely.
Where I want to be: I now want to 'detach' /content and its subfolders from the code base, so that I can delete the hefty /content folder locally without it being deleted on the live server. That way I still would be able to make changes in the code and push them to the server, while people are able to use the CMS to create files and changes in the /content folder.
So what I did so far:
- added the folder to .gitignore:
/content/
- removed the folder from the index:
git rm -r --cached content/*
- tried to set assume-unchanged so that on push, the files in /content would not be deleted from the live server:
git update-index --skip-worktree
When I do this, I of course get a:
fatal: Unable to mark file
Since the files are in .gitignore, and they need to stay there, such that the folder will be ignored in the future. So what do I do?