Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Git line endings in bitbucket pipelines (core.autocrlf)

Patrick Burrows
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 24, 2018

I am trying to use (cloud) bitbucket's pipelines to automatically build my angular app. One of the tslint settings we have in our project is to enforce that line breaks are CRLF.

However, when I try to do a build with pipelines, we get a tslint error for every single line of our code saying that it expected line endings to be CRLF.

Since we don't see that anywhere else on any of our developer's computers, I am guessing that pipelines itself has their git config core.autocrlf set to false.

Also, I already have a .gitattributes file with the contents:

text eol=crlf

What can I specify in my bitbucket-pipelines.yml to tell pipelines to not mess with my line endings?

 

2 answers

1 accepted

0 votes
Answer accepted
Patrick Burrows
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 17, 2018

Thanks for the answer. I asked the same question on StackOverflow and got an answer that works for me. Essentially, the answer is to use the `.gitattributes` file and specify `text eol=crlf`. 

 

I had that set up previously, but the trick is that it doesn't really work unless you explicitly set the file type (which, in retrospect, makes sense). So, for my typescript files (which were the problem for me), I have this entry in my .gitattributes file:

 

*.ts text eol=crlf
0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 16, 2018

Hi Patrick,

I suggest you open a feature request relating to this specific issue. As we have no built-in way to configure the line endings, on clone, at the moment.

As a workaround you'll need to manually change the line endings as part of you build. This bash program, unix2dos, here seems to be useful in this case (I haven't tried it out, so you'll need to report back if it works or not). 

There  are other work arounds suggested here: https://stackoverflow.com/questions/2613800/how-to-convert-dos-windows-newline-crlf-to-unix-newline-lf-in-a-bash-script

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events