Trouble handling Icon\r file with Git

We installed a new process for managing content couple weeks ago, where we had one of the game designer check in his CSV data file into git so we can pull his changes and run the data through our tests automatically. He was on a Mac, so he used GitHub for Mac (very user friendly, by the way) to get his files in.  I tried to pull his changes, and I got an error about some “Icon\r” file. What on earth?!

It turns out that “Icon\r” is a file that exists in all directories that have a custom icon in the Mac OSX Finder.   Normally hidden, but GitHub for Mac sees the file and committed it without any issue.  However, when I was trying to pull that file through git on my Ubuntu box, I get an error telling me that it’s unable to create “Icon\r”.   I tried to use GitHub for Mac to delete the file and commit that change, but GitHub for Mac is failing when trying to commit that delete change with a generic error message.  It looked like they are all having problem with the “\r”, the carriage return character.

I am able to login to GitHub and see the file “Icon ” (\r is not rendered in the browser), but unfortunately there was no way to delete the file there.  After an hour of futile attempt, I finally was able to get rid of it by running “git gui” in my cygwin, and use the interface to select the file and commit that delete.  I’m not sure why or how “git gui” was able to get it done, but there you go – I hope this post may help someone out there.

By the way, you probably want to add that pesky “Icon\r” to the .gitignore file as well so you can prevent them from getting into the codebase in the first place.   For that, you should check out this post on dealing with the “\r” character.

This entry was posted in Development. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment