Replies: 2 comments
-
I had a similar issue as well, and I used the gitattributes fix. |
Beta Was this translation helpful? Give feedback.
-
Hey there, sorry for the long delay. I'm sorry, but I don't think I'll add that to the documentation of the action. This is a general Git issue. I simply think this is out of scope of the documentation for my action. But I'll move this issue to the discussions section instead of closing it for better discoverability. |
Beta Was this translation helpful? Give feedback.
-
Hi! First, let me just say: THANK YOU SO MUCH FOR THIS. It's saved me a ton of time already.
While implementing testing on WSL, I ran into the bizarre error
./.ci.sh: line 4: $'\r': command not found
, e.g. https://github.com/neuropoly/spinalcordtoolbox/runs/1606955337?check_suite_focus=true from https://github.com/neuropoly/spinalcordtoolbox/blob/af36bdedc2ee789a370f101bfec868cdd7ea1e76/.ci.sh.This is because this runs Linux on top of Windows, so
actions/checkout@v2
mangles the line-endings and then Linux sees\r
s and gets confused. To fix this, I needed to forcecore.autocrlf
off:There's an open bug about it: actions/checkout#135 / https://github.saobby.my.eu.orgmunity/t/git-config-core-autocrlf-should-default-to-false/16140/7 but Github doesn't seem interested in fixing it; I bet this is a pretty common gotcha specifically when using WSL, so do you think you could document it in your docs? I see you're very aware of the issue but like most people I had no clue I would run into it until it showed up in my logs, and it took even longer to figure out I needed to add
shell: bash
to the suggested fix counteract your advice to set the default shell to wsl (I only figured it out by half guessing; I saw it here and tried it and it worked).I see people in those threads, including you, recommending
.gitattributes
. In my case, maybe something like this would have done:That's certainly a fix, but my problem comes narrowly from trying to layer Linux on top of Windows, and with docker in the mix. In 99.99% of WSL installs, our users are going to be installing using git from inside WSL, so the glitch will never show up. It's only because CI's
actions/checkout@v2
is running in its own container-on-Windows and deciding that that means it should mangle line endings, so I would rather counteract it in our CI script instead of doing it project-wide.Beta Was this translation helpful? Give feedback.
All reactions