我在WSL2和VSCode上运行Ubuntu。尽管我在VSCode上设置了"LF“,但每当我保存文件时,VSCode都坚持插入一个用git diff
标记为^M
的回车。看看这个:
diff --git a/network/outputs.tf b/network/outputs.tf
index e13366b..f7cc29c 100644
--- a/network/outputs.tf
+++ b/network/outputs.tf
@@ -1,4 +1,4 @@
-output "vpc_id" {
- description = "The ID of the Main VPC"
- value = aws_vpc.main.id
+output "vpc_id" {^M
+ description = "The ID of the Main VPC"^M
+ value = aws_vpc.main.id^M
}
我在VIM上对此没有问题。
发布于 2020-10-30 15:19:01
如果git config --global core.autocrlf=false
还不够,检查是否有.gitattributes
规则(typically core.eol
)可以影响Git提交文件的方式:
git check-attr --all -- network/outputs.tf
https://stackoverflow.com/questions/64598096
复制相似问题