title: Change line ending after cloning a git repository
body: <p>I am cloning a repository on one Windows and one GNU/Linux machine used as gitlab-runners. When the runner's job starts, the code has already been checked out.</p>
  <p>I need those files to have the same line endings on both platforms. This is a <a href="http://conan.io/" rel="nofollow noreferrer">conan</a> requirement: some files will be uploaded and their checksums must match, hence they must use the same end of line characters conventions. So let's use LF everywhere.</p>
  <p>My problem is that I have no control on how the cloning is done. There are some gitlab-ci variables I can set that control how the clone is done, like GIT_SUBMODULE_STRATEGY, etc., but none control line endings. So once the clone is done, I need to find a clean way of changing the end-of-line of the whole repository + submodules.</p>
  <p>The obvious answer is to use <code>git config --global core.crlf false</code> but there are a few problems:</p>
  <ol>
  <li>the line ending constraint exists only when building conan packages, so I'd prefer to not have this global in case the runner builds something else</li>
  <li>it won't work if it's called from the runner job (by that time the code has already been checked out)</li>
  </ol>
  <p>Because of <code>1</code> I tried something around <code>git config core.crlf false</code> (without <code>--global</code>), but problem <code>2</code> remains. There's also problem <code>3</code>:</p>
  <ol start="3">
  <li>it won't work with submodules</li>
  </ol>
  <p>What I have tried to fix problem <code>2</code>:</p>
  <ul>
  <li><code>git reset --hard</code> after changing <code>autocrlf</code> doesn't change the line endings.</li>
  <li><code>git checkout .</code> after changing <code>autocrlf</code> changes them, but not always (worked on the main repo, didn't work inside a submodule)</li>
  </ul>
  <p>So I'm looking for a way to get LF line endings from an already cloned repository, and that would work with submodules.</p>