Search code examples
gitjenkinsline-endingsjenkins-agent

Jenkins do not respect LF line terminator on Windows agent


My company use a Linux Jenkins box and the project is forced to use LF or the build will be failed in style checking. I setup a Windows agent of this Linux Jenkins using "Launch agent via Java Web Start" and Running the Jenkins agent service in this Windows box using a user in its home folder I added one .gitconfig file with the following settings:

[core]
        eol = lf
        autocrlf = false

And "Source Code Management" setting for the agent's task configuration , I use Git and repository pointing to gitlab repository, so Jenkins will create a workspace in the Windows agent and copy the project over to this workspace. However, I notice that all files change to CRLF. What I missed? Is this a known issue of Jenkins?


Solution

  • I solved my problem by reinstall a new git with option: Configuring the line ending conversions to the third option:

    Checkout as-is, commit as is