I am running a web server that allows users to upload images to the server. However, I am using git to manage my source code, and the git push operation deletes anything on the server which doesn't match my local checkout - so I lose the images every time I run git push!
At first I thought that I might be able to protect the uploads folder, so I tried all of these things as suggested in other posts:
- adding the directory to .gitignore,
git rm --cached -r uploadsgit update-index --assume-unchanged uploads
None of these solve the issue - the remote directory always disappears when I do git push.
Next, I decided to put the uploaded files outside of git's working area, so that git push does not delete it. Then I created a symbolic link from the public directory to the private directory so I can see the files publicly. So far so good... However, whenever I run git push it deletes the symbolic link!
Finally, I thought that perhaps I could use a post-receive git hook to create the symbolic link every time I push, but my web server (openshift) is already using that hook for something else and won't allow me to edit it.
There is surely a simple way of doing this?! Please help!