user2125722 user2125722 - 1 year ago 68
Git Question

"Please make sure all files only have LF endings" error when pushing to a GitHub repo

I am new to Git. I forked a repo, created a branch, made some changes, committed and then when I push (git push origin master), I get the following error :

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

I am running git on Windows 7. Can anyone please help me ? Thanks.

PS: I went through this and this

UPDATE : The 'Please use spaces instead of tabs.' error was corrected by converting TAB to Spaces in 'Edit->Blank Operations->TAB to space' for Notepad++.

Answer Source

The error means that the project requires Unix-style line endings (LF). However, you are using Windows-style line endings (CRLF). All decent programming text editors and IDEs have an option to set this. Editors also have an option to quickly replace all CRLF sequences with just LF. You need to find out how to do this in yours.

I also suggest that you learn about branching in git. If you are contributing to a larger project, it will be required that you create a new branch for each related set of changes that you want to make. Committing directly to master is seriously frowned upon.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download