繁体   English   中英

Git Windows 共享卷与 Unix docker 容器的行尾问题

[英]Git Line Endings problem on a Windows shared volume with a Unix docker container

我正在开发 Windows 并使用 centOS docker 容器进行开发。 我还有一个在容器和本地文件夹之间共享的卷。

问题是:将存储库从 windows 克隆到共享卷或从容器克隆到共享卷时, git status在容器和本地计算机上执行时不会返回相同的内容。 我希望它是相同的并尝试了不同的配置但没有成功:

  • git config --global core.autocrlf true/input/false在本地机器和容器中
  • git config --global core.crlf true/false/auto在本地机器和容器中
  • git config --global core.eol lf ...

是否有人拥有 Git 的正确配置,可以在不修改 .git 属性的情况下从容器和本地机器上获得相同的git status

配置行尾的方法是:

在 Linux 上:

git config --global core.autocrlf input

在 Windows 上:

git config --global core.autocrlf true

您还可以设置特定于存储库的配置:

cd /path/to/repo
git config core.autocrtlf <value>

在您的情况下,听起来如果您在 CentOS 容器中设置git config --global core.autocrlf input并为您的 Windows 机器设置git config --global core.autocrlf true ,则应该没有问题。

暂无
暂无

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

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