0

I have a folder public/data1/images. In that folder are images that are used throughout the database.

I'm having a problem when I do git push origin master - it overwrites the images that the database uses.

How can I keep the images that are being used in the database and not overwrite those files when pushing to the server? I have tried to use git ignore but I'm not keeping the images on the server.

Xiong Chiamiov
  • 13,076
  • 9
  • 63
  • 101
ONYX
  • 5,679
  • 15
  • 83
  • 146
  • Did you add the images to the repo? Is the server repo bare? Tell us more. We are dying to know. – Mad Physicist Feb 22 '16 at 03:22
  • No the server repo has some images being uploaded but there's nothing being used only when I add images through the database does that folder get overriden when doing a git push – ONYX Feb 22 '16 at 03:24
  • Do you have `bare` repo on the server ? If its bare repo, its directory structure will not be equal to local repository structure and uploading files to this repo directory is not recommended. Could you also check if there is any hook at server side which updates your images. – Royal Pinto Feb 22 '16 at 04:19
  • You really need to provide some sample outputs and show the commands you are running, otherwise we are just stabbing in the dark here. – Mad Physicist Feb 22 '16 at 14:30

1 Answers1

0

You can using git update-index --assume-unchanged <file> on the server. So that folder will does not change when you change on local.

t10508hn
  • 789
  • 1
  • 5
  • 10
  • I gave your answer a try but it's still overwriting that folder when I push – ONYX Feb 22 '16 at 03:29
  • it says Ignoring path public/data1/images/ and then I do a push origin master and it's removing the file I just uploaded to the server. – ONYX Feb 22 '16 at 03:32
  • can you push some images. when git status. Before and after git pull (update form remote) – t10508hn Feb 22 '16 at 03:44
  • I can't push new images when using update-index I tried it using git add --all and git commit but the newly added image through the database gets overritten – ONYX Feb 22 '16 at 04:14
  • http://stackoverflow.com/questions/482309/how-do-you-get-git-to-ignore-all-contents-of-a-directory i think its your solution? – t10508hn Feb 22 '16 at 08:17
  • Remember that when add gitinorge a file that you added in to git. You have to clear cached. http://stackoverflow.com/questions/11451535/gitignore-not-working – t10508hn Feb 22 '16 at 08:18