Git - Windows和Linux行尾 [英] Git - Windows AND linux line-endings

查看:149
本文介绍了Git - Windows和Linux行尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主要操作系统是windows 10。



我有一个运行在Vagrant中的Ubuntu 14.04盒子,用于开发我的应用程序。这个盒子正在运行SMB,它使我能够访问Ubuntu服务器的根文件。

在Ubuntu服务器上,我的应用程序文件位于GIT repo中,并带有一个gitlab服务器。我的Windows机器上运行SourceTree,通过SMB共享连接到Ubuntu GIT仓库(所以我假设它使用我的Windows GIT安装)。

>

ubuntu机器上的Git状态不会改变。



Windows和SourceTree上的Git状态表明所有文件都已更改(因为行结束)。

为了能够在Windows和Linux上使用相同的本地回购,我应该使用哪种操作系统的设置?

   

解决方案 $ g $ config --global core.autocrlf true

在Linux上:

  $ git config --global core.autocrlf input 

了解更多关于处理行结束符


My main OS is windows 10.

I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server.

On the Ubuntu server I have my application files in a GIT repo with a gitlab server as the origin.

I run SourceTree on my windows machine that connects to the ubuntu GIT repo through the SMB share (so I assume it uses my Windows GIT installation).

Git status on the ubuntu machine gives no changes.

Git status on Windows and SourceTree indicate that all the files have changed (because of the line endings).

What settings on which OS should I use in order to be able to use the same local repo on both Windows and Linux?

解决方案

On Windows:

$ git config --global core.autocrlf true

On Linux:

$ git config --global core.autocrlf input

Read more about Dealing with line endings

这篇关于Git - Windows和Linux行尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆