git replacing LF with CRLF

前端 未结 20 1466
眼角桃花
眼角桃花 2020-11-21 23:31

Running git on a Windows XP machine, using bash. I exported my project from SVN, and then cloned a bare repository.

I then pasted the export into the bare repositori

20条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 00:13

    Both unix2dos and dos2unix is available in windows with gitbash. You can use the following command to perform UNIX(LF) -> DOS(CRLF) conversion. Hence, you will not get the warning.

    unix2dos filename
    

    or

    dos2unix -D filename
    

    But, don't run this command on any existing CRLF file, then you will get empty newlines every second line.

    dos2unix -D filename will not work with every operating system. Please check this link for compatibility.

    If for some reason you need to force the command then use --force. If it says invalid then use -f.

提交回复
热议问题