Jon Gallant

Solution to PNG files not rendering on GitHub

1 min read

I do most of my dev in WSL and occasionally I screw up line endings between Windows and WSL. I wanted to solve the line ending changes so I added a .gitattributes to root of repo file with this:

Terminal window
- text eol=lf
```text
Everything worked great locally, but when I pushed to GitHub all of my pngs were borked.
So I did some sleuthing and discovered that I should add this to my `.gitattributes` file so pngs are treated as binary files.
```bash
- text=auto
- text eol=lf
- .png binary
```text
In order for those changes to take effect, I had to run the following:
```bash
git rm --cached -r .
git add -A

I then committed and pushed to GitHub and that resolved the problem.

Jon

Share:
Share on X