Search code examples
zippipebitbucket

Bitbucket pipelines created zip removing formatting


I have a bitbucket repository, where we are building code and creating a zip after every checkin.

Script to create ZIP:

zip -r /usr/path/file.zip ./FOLDER

zip is being created perfectly, and the zipped file has cong file(test.conf). After zip file is created, formatting of test.conf is changed in zipped file. So code is not able to read data from zipped file. Is there any way to keep the formatting intact (as it is) in the zipped file as well?

In the zipped file all the CR = Carriage Return are removed. How I can keep that intact?


Solution

  • I have found the solution for above problem. I fixed the issue by adding .gitattributes file with below content in my git repository.

    *.conf eol=crlf
    

    Which means:

    These files are text and should be normalized (Convert crlf => lf)

    Exclude files from exporting ending with .conf.