[英]Can I replace Unix line endings with Windows line endings on the commandline?
[英]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.