[GIT] warning: LF will be replaced by CRLF问题解决方法

本文详细介绍了在使用Git生成Rails工程时遇到的换行符从LF转换为CRLF的问题,提供了删除.git文件和设置core.autocrlf为false的解决方法,确保了代码的一致性和正常运行。

操作系统: windows 7

git version 1.8.3.msysgit.0

 

git init

git add .

系统出现如下错误:warning: LF will be replaced by CRLF

 

原因分析:

CRLF -- Carriage-Return Line-Feed 回车换行

就是回车(CR, ASCII 13, \r) 换行(LF, ASCII 10, \n)。

这两个ACSII字符不会在屏幕有任何输出,但在Windows中广泛使用来标识一行的结束。而在Linux/UNIX系统中只有换行符。

也就是说在windows中的换行符为 CRLF, 而在linux下的换行符为:LF

使用git来生成一个rails工程后,文件中的换行符为LF, 当执行git add .时,系统提示:LF 将被转换成 CRLF

 

解决方法:

 

删除刚刚生成的.git文件

 

$ rm -rf .git

$ git config --global core.autocrlf false

 

这样系统就不会去进行换行符的转换了

最后重新执行

请分析下面报警 je14902@JAIT14902D MINGW64 ~/IdeaProjects/erc-web $ git init Initialized empty Git repository in C:/Users/je14902/IdeaProjects/erc-web/.git/ je14902@JAIT14902D MINGW64 ~/IdeaProjects/erc-web (master) $ git remote add origin http://10.105.191.35:8090/mes-surrounding/erc-web.git je14902@JAIT14902D MINGW64 ~/IdeaProjects/erc-web (master) $ git add . warning: LF will be replaced by CRLF in .env. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in .env.development. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in LICENSE. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in babel.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in package.json. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/index.html. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/@antv/data-set.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/axios/axios.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/clipboard/clipboard.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/js-cookie/js.cookie.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/nprogress/nprogress.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/vue-router/vue-router.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/vue/vue.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/js/vuex/vuex.min.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/App.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/bootstrap.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/cache/AKeepAlive.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/card/ChartCard.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/Bar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/MiniArea.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/MiniBar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/MiniProgress.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/Radar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/RankingList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/Trend.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/chart/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/checkbox/ColorCheckbox.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/checkbox/ImgCheckbox.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/checkbox/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/exception/ExceptionPage.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/exception/typeConfig.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/form/FormRow.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/input/IInput.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/menu/Contextmenu.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/menu/SideMenu.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/menu/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/menu/menu.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/mes/signoffform/formdetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/modal/drag.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/page/header/PageHeader.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/page/header/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/result/Result.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/setting/Setting.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/setting/SettingItem.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/setting/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/StandardTable.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/advance/ActionColumns.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/advance/ActionSize.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/advance/AdvanceTable.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/advance/SearchArea.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/advance/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/table/api/ApiTable.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/task/TaskGroup.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/task/TaskItem.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/AStepItem.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/AvatarList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/DetailList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/Drawer.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/FooterToolBar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/HeadInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/TagSelect.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/tool/TagSelectOption.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/components/transition/PageToggleTransition.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/default/admin.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/default/animate.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/default/antd.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/default/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/default/setting.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/replacer/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/config/replacer/resolve.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/AdminLayout.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/BlankView.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/CommonLayout.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/PageLayout.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/PageView.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/footer/PageFooter.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/AdminHeader.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/HeaderAvatar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/HeaderNotice.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/HeaderSearch.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/Notice.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/NoticeBar.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/header/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/tabs/TabsHead.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/tabs/TabsView.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/tabs/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/layouts/tabs/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/main.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/common/activityData.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/common/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/common/tableData.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/extend/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/goods/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/project/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/user/current.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/user/login.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/user/routes.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/mock/workplace/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/Demo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/changeOwner/ChangeOwner.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/customer/Customer.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/documentType/DocumentType.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/helpDocument/HelpDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/mailTemplate/MailTemplate.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/notice/Notice.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/permission/Permission.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/search/searchPqs.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/administrator/watermark/Watermark.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/AddDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/CustomerInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/CustomerInfo2.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/CustomerInfo3.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/InternalInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/InternalInfo2.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/InternalInfo3.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/TemporaryInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/TemporaryInfo2.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/add/components/TemporaryInfo3.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/permission/PermissionApplication.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/review/ReviewDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/update/UpdateDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/update/components/CustomerInfo copy.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/update/components/CustomerInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/apply/update/components/InternalInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/components/Palette.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/components/TaskCard.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/components/table/Api.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/components/table/Table.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/components/table/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/Analysis.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/HotSearch.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/SalesData.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/i18n-search.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/analysis/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/workplace/WorkPlace.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/workplace/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/workplace/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/dashboard/workplace/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/detail/AdvancedDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/detail/BasicDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/document/effective/EffectiveDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/document/pendingReview/PendingReviewDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/document/toBeEffective/ToBeEffectiveDocument.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/ecnNo/ecnInfo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/ecnNo/ecnNo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/BU/BU.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/ChangeCurrentOwner/ChangeCurrentOwner.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/Document/Document.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/Employee/employee.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/FrozenEmployee/FrozenEmployee.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/FrozenList/FrozenList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/Module/Module.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/Notice/Notice.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Administration/WaferType/WaferType.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Applications/Applications.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Drafts/Drafts.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/ForMFGManager/ForMFGManager.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/AutoReposition.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/AutoRepositionDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/Autoreposition copy.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/CompareResult.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/Mlcs copy.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/MlcsDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/Normal.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/Erc/NormalDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/NewApplication/NewApplication.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Process/myProcess.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Search/Search copy.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Search/Search.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Test/ChangeOwner.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Test/MaintainArea.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Test/MaintainRoleMember.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Test/Rescind.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Test/changestatus.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Todo/Todo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/erc/Unlock/unlock.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/exception/403.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/exception/404.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/exception/500.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/AdvancedForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/RepositoryForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/TaskForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/UserForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/i18n-repository.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/i18n-task.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/i18n-user.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/advance/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/basic/BasicForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/basic/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/basic/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/Step1.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/Step2.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/Step3.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/StepForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/form/step/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/formMange/distribute/DistributeForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/formMange/distribute/DistributeFormDetail.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/formMange/reject/RejectForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/home/home.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/homes/homes.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/CardList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/QueryList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/StandardList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/search/ApplicationList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/search/ArticleList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/search/ProjectList.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/search/SearchForm.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/list/search/SearchLayout.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/login/Login.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/login/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myApplication/Application.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myCollection/Collection.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myDistribution/Distribution.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myDone/Done.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myDraft/Draft.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/personalCenter/myTodo/Todo.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/result/Error.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/pages/result/Success.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/plugins/authority-plugin.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/plugins/i18n-extend.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/plugins/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/plugins/tabs-page-plugin.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/async/config.async.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/async/router.map.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/guards.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/api.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/customer.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/customerSignItem.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/distribute.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/doc.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/docCorrelate.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/docFile.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/docVersion.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/erc/myConfig.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/favorite.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/getConfig.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/getDocType.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/help.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/mailTemplate.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/mes.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/myApplication.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/myDone.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/myDraft.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/myTodo.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/notice.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/npi.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/permission.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/signOrg.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/tmpFile.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/user.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/watermark.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/wf.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/wf.js.bak. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/workOrder.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/services/workOrderMapping.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/store/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/store/modules/account.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/store/modules/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/store/modules/setting.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/antd/ant-menu.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/antd/ant-message.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/antd/ant-table.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/antd/ant-time-picker.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/antd/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/default/color.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/default/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/default/nprogress.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/default/style.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/index.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/style.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/theme/theme.less. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/Objects.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/authority-utils.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/axios-interceptors.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/colors.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/formatter.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/i18n.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/request.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/routerUtil.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/theme-color-replacer-extend.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/themeUtil.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/utils/util.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in vue.config.js. The file will have its original line endings in your working directory
01-16
你贴出的命令行内容是一个标准的 Git 初始化和添加远程仓库的过程,接着出现了大量 `LF will be replaced by CRLF` 的警告信息。下面我将为你详细分析这些信息和警告的含义、是否影响使用,以及如何解决。 --- ## 🧾 你执行了以下 Git 操作: ```bash git init git remote add origin http://10.105.191.35:8090/mes-surrounding/erc-web.git git add . ``` 这些命令完成了以下工作: | 命令 | 作用 | |------|------| | `git init` | 初始化一个空的 Git 仓库 | | `git remote add origin ...` | 添加远程仓库地址 | | `git add .` | 将当前目录下所有文件添加到 Git 暂存区 | --- ## ⚠️ 警告分析:`LF will be replaced by CRLF` ### 🔍 含义: - **LF**(Line Feed)是 Unix/Linux 和 macOS 中的换行符(`\n`)。 - **CRLF**(Carriage Return + Line Feed)是 Windows 中的换行符(`\r\n`)。 这个警告的意思是: > Git 检测到你正在 Windows 上工作,它会将文件中的 LF(`\n`)自动转换为 CRLF(`\r\n`)以适应 Windows 的换行习惯。当你提交文件时,Git 又会将 CRLF 转回 LF,以保证远程仓库中的文件保持一致。 --- ## ✅ 这个警告是否严重? - **不是错误,只是警告**。 - 如果你只是在 Windows 上开发,且不涉及跨平台协作(比如有人在 macOS 或 Linux 上开发),可以忽略。 - 如果你是在团队协作中,尤其是跨平台团队,建议统一换行符规则,以避免不必要的差异。 --- ## 🛠 如何解决或关闭这个警告? ### ✅ 方法 1:配置 Git 自动换行处理策略(推荐) ```bash # 设置 Git 自动转换换行符(提交时保持 LF,检出时转为 CRLFgit config --global core.autocrlf true ``` > - `true`:Windows 推荐设置 > - `input`:Linux/macOS 推荐设置 > - `false`:禁用自动换行符转换 --- ### ✅ 方法 2:禁用换行符自动转换(如果你不想让 Git 干预) ```bash git config --global core.autocrlf false ``` > ⚠️ 使用此设置时,要确保所有开发者使用相同的换行符格式(推荐使用 LF),否则可能会出现文件差异问题。 --- ### ✅ 方法 3:使用 `.gitattributes` 文件统一换行规则(推荐) 在项目根目录下创建 `.gitattributes` 文件,并添加以下内容: ```gitattributes * text=auto ``` 或者更精确地控制: ```gitattributes *.txt text *.js text *.vue text *.json text *.md text *.png binary *.jpg binary ``` 这样 Git 会根据文件类型决定是否自动处理换行符。 --- ## 📌 总结 | 问题 | 解决方案 | |------|----------| | 出现 `LF will be replaced by CRLF` 警告 | Git 在 Windows 上自动转换换行符 | | 是否需要处理 | 如果是团队协作或跨平台项目,建议配置统一换行规则 | | 推荐做法 | 使用 `git config core.autocrlf true` + `.gitattributes` 文件 | ---
### 问题分析 在 Git 中,当你在 Windows 系统上使用 `git add .` 命令时,出现警告信息 `warning: LF will be replaced by CRLF in Makefile`,这是因为 Git 的自动换行符转换机制(`core.autocrlf`)被启用。 LF(Line Feed)是 Unix/Linux 系统中的换行符,而 CRLF(Carriage Return + Line Feed)是 Windows 系统中的换行符。Git 为了统一跨平台协作,提供了自动转换换行符的功能,但在某些情况下会导致文件被误认为是被修改过,从而触发此警告。 ### 解决方案 #### 方法一:禁用自动换行符转换 如果希望保留原始换行符格式,可以禁用 Git 的自动换行符转换功能: ```bash git config --global core.autocrlf false ``` 这样,Git 将不会对文件的换行符进行自动转换,从而避免警告信息的出现。 #### 方法二:设置为仅提交时转换 如果你希望在提交时将 CRLF 转换为 LF,但在检出时保持 LF,可以使用以下命令: ```bash git config --global core.autocrlf input ``` 此设置适用于 Unix/Linux 和 macOS 用户,确保提交时换行符为 LF,而在检出时不进行转换。 #### 方法三:手动处理文件换行符 如果你只想针对特定文件(如 `Makefile`)处理换行符问题,可以使用 `.gitattributes` 文件来定义特定文件的换行符处理方式。例如: 1. 在项目根目录下创建或编辑 `.gitattributes` 文件。 2. 添加以下内容: ```plaintext Makefile text eol=lf ``` 此配置会强制 Git 在处理 `Makefile` 文件时使用 LF 作为换行符,避免自动转换。 #### 方法四:清理并重新添加文件 如果已经存在换行符不一致的问题,可以尝试以下步骤清理并重新提交文件: ```bash git rm --cached -r . git reset git add . git commit -m "Fix line endings" ``` 这将重新缓存所有文件,并按照当前 `core.autocrlf` 设置处理换行符。 ### 注意事项 - 修改 `core.autocrlf` 配置后,建议重新初始化 Git 缓存,以确保更改生效。 - 如果项目是跨平台协作的,建议团队成员统一换行符处理策略,以避免不必要的冲突和警告。
这个报错是因为不同的操作系统使用不同的换行符。在 Windows 中,每行的结尾是由两个字符组成的:一个回车符(Carriage Return)和一个换行符(Line Feed),简称 CRLF。而在 Unix/Linux 和 macOS 中,每行的结尾只有一个换行符(Line Feed),简称 LF。 当你在 Windows 上使用 Git 时,Git 会默认将换行符转换为 CRLF,以便与 Windows 系统兼容。但是如果你将代码提交到 Linux 或 macOS 系统上,就会出现类似的警告。 要解决这个问题,可以在提交代码前将 Git 的 core.autocrlf 设置为 false。具体步骤如下: 1. 打开 Git Bash 终端。 2. 输入以下命令: ```bash git config --global core.autocrlf false ``` 这会将 Git 的 core.autocrlf 设置为 false,即禁止自动将换行符转换为 CRLF。 3. 提交代码时,Git 将保留原来的换行符,不会进行转换。 另外,你也可以在设置中将 LF 转换为 CRLF,这样在 Windows 上就能正常显示换行符了。具体操作方法为: 1. 打开 Git Bash 终端。 2. 输入以下命令: ```bash git config --global core.autocrlf true ``` 这会将 Git 的 core.autocrlf 设置为 true,即将 LF 转换为 CRLF。 3. 提交代码时,Git 会自动将 LF 转换为 CRLF。 不过需要注意的是,你应该根据实际情况选择是否进行转换。如果你的代码主要运行在 Linux 或 macOS 系统上,建议将 core.autocrlf 设置为 false,以保留原有的换行符;如果你的代码主要运行在 Windows 上,建议将 core.autocrlf 设置为 true,以便在 Windows 中正常显示换行符。
`LF will be replaced by CRLF` 警告通常是由于 Git 在处理文本文件时,换行符不一致导致的。Git 默认会尝试将换行符统一为 CRLF(Windows 风格)或 LF(Unix/Linux 风格),当文件的换行符与仓库的配置不匹配时,就会出现这个警告。以下是几种解决该警告的方法: ### 方法一:修改 Git 配置 可以通过修改 Git 的 `core.autocrlf` 配置来控制换行符的处理。有以下几种设置方式: #### 设置为 `true` 如果在 Windows 系统上工作,可将 `core.autocrlf` 设置为 `true`,这样 Git 在检出文件时会将 LF 转换为 CRLF,在提交文件时会将 CRLF 转换为 LF。 ```bash git config --global core.autocrlf true ``` #### 设置为 `input` 如果在 Unix/Linux 或 macOS 系统上工作,可将 `core.autocrlf` 设置为 `input`,这样 Git 在提交文件时会将 CRLF 转换为 LF,在检出文件时不会进行转换。 ```bash git config --global core.autocrlf input ``` #### 设置为 `false` 如果希望 Git 不进行换行符的转换,可将 `core.autocrlf` 设置为 `false`。 ```bash git config --global core.autocrlf false ``` ### 方法二:使用 `.gitattributes` 文件 可以在项目根目录下创建一个 `.gitattributes` 文件,明确指定哪些文件使用哪种换行符。例如,对于 `MusicPlayer/image/images/recImage.qrc` 和 `MusicPlayer/image/images/resource.qrc` 文件,可以添加以下内容: ```plaintext MusicPlayer/image/images/recImage.qrc text eol=lf MusicPlayer/image/images/resource.qrc text eol=lf ``` 上述配置指定这两个文件使用 LF 作为换行符。 ### 方法三:手动转换换行符 可以使用文本编辑器手动将文件的换行符转换为一致的格式。大多数现代文本编辑器(如 Visual Studio Code)都支持换行符的转换。在 Visual Studio Code 中,可以点击右下角的 `LF` 或 `CRLF` 进行切换。
### 警告信息的含义 当执行 `git add .` 命令时出现警告信息 `LF will be replaced by CRLF in A.txt`,这表示 Git 检测到文件 `A.txt` 中的换行符是 LF(Line Feed),而当前 Git 配置的换行符转换规则要求使用 CRLF(Carriage Return + Line Feed)。 在 Windows 平台下,文本文件的默认换行符是 CRLF,而 Unix/Linux 系统使用 LFGit 提供了自动处理换行符的功能,以确保跨平台开发时文件的兼容性。当文件中包含 LF 换行符时,Git 会在将其添加到暂存区时自动将其转换为 CRLF,并提示这一警告信息[^1]。 ### 警告信息的触发条件 此警告信息的触发通常与文件的换行符格式和 Git 的配置相关。如果在 Windows 平台下编辑文件,通常文件的换行符会是 CRLF,此时 `git add` 操作不会触发警告。然而,如果文件在 Unix/Linux 环境中编辑过,或者由于某些编辑器配置导致文件保存为 LF 换行符,再在 Windows 系统上执行 `git add` 时,就会触发此警告[^2]。 ### Git 对换行符的处理机制 Git 在处理换行符时,会根据配置的 `core.autocrlf` 选项决定是否对换行符进行转换。例如,在 Windows 上,如果 `core.autocrlf` 设置为 `true`,Git 会在提交时自动将 LF 转换为 CRLF,并在检出时将 CRLF 转换回 LF。这一机制确保了不同平台下的开发者可以正常处理文件,但同时也会在检测到换行符不一致时发出警告[^1]。 可以通过以下命令查看当前的换行符配置: ```bash git config core.autocrlf ``` ### 示例:配置换行符行为 如果希望 Git 在 Windows 上自动处理换行符转换,可以使用以下命令进行配置: ```bash git config --global core.autocrlf true ``` 如果希望禁用自动转换功能,可以设置为: ```bash git config --global core.autocrlf false ``` 此配置会影响 Git 在添加文件时是否对换行符进行转换,从而影响是否出现警告信息[^2]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值