gpt4 book ai didi

git - 推送到 GitHub 存储库时出现 "Please make sure all files only have LF endings"错误

转载 作者:太空狗 更新时间:2023-10-29 14:44:05 25 4
gpt4 key购买 nike

我是 Git 新手。我 fork 了一个 repo,创建了一个分支,做了一些更改,提交了,然后当我推送(git push origin master)时,我收到以下错误:

     Starting Pattern Checks

.gitattributes --> Please make sure all files only have LF endings (no CRLF).
core/templates/dev/head/dashboard/notifications_dashboard.html --> Please use spaces instead of tabs.

(41 files checked, 2 errors found)
FAILED Pattern checks failed
Push failed, please correct the linting issues above

我在 Windows 7 上运行 git。任何人都可以帮助我吗?谢谢。

PS:我经历了thisthis

更新:“请使用空格而不是制表符。”通过在 Notepad++ 的“编辑->空白操作->TAB 到空格”中将 TAB 转换为空格来更正错误。

最佳答案

该错误意味着该项目需要 Unix 风格的行结尾 (LF)。但是,您使用的是 Windows 样式的行结尾 (CRLF)。所有体面的编程文本编辑器和 IDE 都有一个选项来设置它。编辑器还可以选择将所有 CRLF 序列快速替换为 LF。您需要了解如何在您的系统中执行此操作。

我还建议您了解 git 中的分支。如果您正在为一个更大的项目做贡献,则需要为您要进行的每组相关更改创建一个新分支。直接提交给 master 是非常不受欢迎的。

关于git - 推送到 GitHub 存储库时出现 "Please make sure all files only have LF endings"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39024762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com