user2125722
user2125722

Reputation: 1328

"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++.

Upvotes: 2

Views: 177

Answers (2)

Stavm
Stavm

Reputation: 8131

In Notepad++, go to the View menu > Show Symbol > Show End of Line. now press CTRL + H, make sure the Extended search mode is selected, and replace all \r\n with \n

Save. now try.

enter image description here

P.S: as Bergi also suggested, you may also automate both of your requirements via notepad by going to:

the Edit Menu>Blank Operations> Tab to Space

the Edit menu>EOL Conversion> UNIX/OSX Format

Upvotes: 1

Code-Apprentice
Code-Apprentice

Reputation: 83537

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.

Upvotes: 2

Related Questions