简体   繁体   English

如何将 git 存储库从 Windows 迁移到 Linux? (CRLF - LF 问题)

[英]How can I migrate a git repo from Windows to Linux? (CRLF - LF issue)

I started a git repository on a Windows machine, and then I changed to a Linux machine.我在 Windows 机器上启动了一个 git 存储库,然后我换成了 Linux 机器。 Everything is working fine, but every time I commit, I get the warning warning: CRLF will be replaced by LF in [file] .一切正常,但每次提交时,我都会收到警告warning: CRLF will be replaced by LF in [file] I know I can set auto conversion off but, is there a command to convert all line endings into the Linux's form?我知道我可以关闭自动转换,但是,是否有将所有行结尾转换为 Linux 形式的命令? I am not going to work with this project in Windows any more.我不会再在 Windows 中处理这个项目了。 Thanks in advance.提前致谢。

There is a dos2unix command which will change a text file from dos format (using CR LF) to unix format (using just LF).有一个 dos2unix 命令可以将文本文件从 dos 格式(使用 CR LF)更改为 unix 格式(仅使用 LF)。 Using that, you can easily do something like使用它,您可以轻松地执行以下操作

dos2unix *.c *.h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM