在Windows和Mac之间共享文件的git错误

问题描述:

我最近有一个问题,因为头部和这些文件,git无法合并。 (Netbeans说)在Windows和Mac之间共享文件的git错误

所以我试着用Git Bash做它,它给了我关于.DS_Store的一些错误。所以我删除了这些文件,现在当我尝试合并时,几乎所有文件都具有“两个修改”文本,即使它们看起来完全相同。

@@@ -1,10 -1,10 +1,22 @@@ 
-<html> 

-<head> 

- <title>403 Forbidden</title> 

-</head> 

-<body> 

- 

-<p>Directory access is forbidden.</p> 

- 

-</body> 

    <<<<<<< HEAD 
+<html> 
+<head> 
+ <title>403 Forbidden</title> 
+</head> 
+<body> 
+ 
+<p>Directory access is forbidden.</p> 
+ 
+</body> 
    ======= 
++<html> 
++<head> 
++ <title>403 Forbidden</title> 
++</head> 
++<body> 
++ 
++<p>Directory access is forbidden.</p> 
++ 
++</body> 
    >>>>>>> 4dd01fd4 
    </html> 

但它似乎是增加了一个额外的意图?

我该如何解决这个问题?

我认为这是由于文件中不同的行尾(回车(\ r)/换行符(\ n))。检查它们是否一致。

我认为旧文件已保存在Windows(\ r \ n)下。

+0

是的,我们是一些开发者,一些在Mac上,一些在Windows上。有什么想法? :) – Muqito 2013-02-21 16:34:00

+3

最好是你设置你的编辑使用相同的行结束。或者你可以让git为你管理它们:https://help.github.com/articles/dealing-with-line-endings – weitho 2013-02-21 16:38:36

+0

我无法得到这个工作:(我试图在netbeans中设置它和git bash – Muqito 2013-02-21 17:29:12