A tip for Windows users

I’ve always done development (and everything else) on Linux and macOS and only switch to a Windows box to test compatibility. While developing in Zig, I went over to Windows and merrily cloned one of my repos to find that it didn’t compile. The errors were all mentioning line breaks such as \n etc. After a while searching the Web, I found this comment which solved the problem for me.

The TL;DR is, on Windows when cloning a repo use this command:

$ git clone --config core.autocrlf=false <repo-url-here>

This tells git not to mangle your Zig code in order to satisfy Windows’ archaic line break handling.


You can also add this to the .gitattributes file in your repo

*.zig text eol=lf

For example: zig/.gitattributes at master · ziglang/zig · GitHub


That’s a terrible default setting that Git has. I can’t believe they still keep it enabled by default.


yeah zigmod init has an option to add this line automatically since many folks don’t know about core.autocrlf=false

1 Like

Ugh, yes, this has caught me in the past. I’m always left dazed and bewildered - it’s a glimpse at an alternate universe where FTP still reigns and Clippy chases us through darkened hallways screaming in modals about OneDrive credentials.

1 Like

I miss PowerPup…