Line endings

I had a really weird problem that took a while to track down. I develop on a linux desktop, but to get files onto servers I need to route them via a Windows PC. When I just copied files onto OneDrive, and then over onto the server everything worked really well. However, I thought it would be easier to work off my git repo, so I cloned that onto the Windows machine. In one sense it was great, in that any changes on the server file are just an scp and a git add away from the repo. But I got really badly stung by a bash script that freaked out about the Windows line endings. I’d forgotten about this, because of course you can develop on Windows, commit away and push to a GitHub repository, and the line endings are magically fixed for you. However, because of this slightly weird workflow, I got stung. It turns out the answer was to set a .gitattributes file with the argument * text eol=lf (which may of course cause other problems on Windows, but I can’t install INLA on my Windows machine so I don’t think I have to worry about that just yet). However, it does mean I can just scp the files onto the server and everything is now working.