Fixing image corruption in Git
Tuesday, August 4th, 2015 | Programming, Tech
You may find that all the images you commit to a git repo are corrupting. This is especially true if you are using Windows and then pushing to a Linux origin.
One possible fix is to ensure the images are being treated as binary files. Of course everything is a binary file when it comes down to it, but this differentiates it from text. To do this, add the following lines to a .gitattributes file in the root of the repo.
*.jpg binary
*.png binary
*.gif binary
If you have images in there already, you will probably need to remove them and then re-commit them.
You may find that all the images you commit to a git repo are corrupting. This is especially true if you are using Windows and then pushing to a Linux origin.
One possible fix is to ensure the images are being treated as binary files. Of course everything is a binary file when it comes down to it, but this differentiates it from text. To do this, add the following lines to a .gitattributes file in the root of the repo.
*.jpg binary
*.png binary
*.gif binary
If you have images in there already, you will probably need to remove them and then re-commit them.