2

我在 WSL2 和 VSCode 上运行 Ubuntu。虽然我在 VSCode 上有“LF”设置,但每当我保存文件时,VSCode 坚持插入一个标记^Mgit diff. 一探究竟:

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 上对此没有任何问题。

4

1 回答 1

0

如果git config --global core.autocrlf=false还不够,请检查是否存在可能影响 Git 如何提交文件的.gitattributes规则(通常):core.eol

git check-attr --all -- network/outputs.tf
于 2020-10-30T07:19:00.533 回答