question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clear BOM before pushing files to the GitHub server

See original GitHub issue

Greetings! I will try to explain the problem that has occurred in the headings of other issues without the text associated with the encoding of UTF-8.

Description

The source text in the markup files (MarkDown, html, etc.) is stored in UTF-8. When I save the text in Windows, BOM (0xEF, 0xBB, 0xBF) is added to the beginning of the file. (In Linux operating systems, files in the UTF-8 encoding are created without a BOM.) BOM stays when I pushed of data from the GitHub Desktop to the server, which can adversely affect the working of the source code. Usually to remove the BOM used third-party apps, such as Notepad++, which is not very convenient. Can GitHub Desktop delete from the BOM files when I push files to the Github server?

Version

GitHub Desktop version: 3.3.4.0

OS version: Microsoft Windows [Version 6.1.7601]

Steps to Reproduce

  1. I create a text file through Windows Explorer
  2. I type the text and save it in the encoding of UTF-8
  3. I change the file extension to MD
  4. Does not solve the problem find . -type f \( -name '*.md' -o -name '*.html' \) -print0 | xargs -0 grep -l ``printf '^\xef\xbb\xbf'`` | xargs sed -i '1 s/^\xef\xbb\xbf//' single `
  5. I push the changes to the server

Expected behavior: https://github.com/jekyll/minima/blame/a4726e60/index.md#L1

Actual behavior: https://github.com/bopoh13/grok/blame/7fb3be1f/index.md#L1

Reproduces how often: everytime

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shiftkeycommented, Jan 11, 2018

@bopoh13 I think this is a limitation of notepad.exe - I was able to reproduce this issue using the version of notepad that ships in Windows 10.

Can GitHub Desktop delete from the BOM files when I push files to the Github server?

This isn’t the right place to handle these changes - they need to be caught before committing, because after that the file contents (“blobs” in Git terminology) are tied to the created commit. You can’t change one without changing the other.

Git itself is not opinionated about the file contents which you add to the repository, and Desktop has no plans to warn about BOMs, so I’d recommend using tools like Notepad++ that you can trust to handle files in a cross-platform way.

0reactions
h8norcommented, Sep 13, 2019

✔️ The client hook must be placed on a local computer in the REPO\.git\hooks without extension .sh. The rest will be done by the git himself. The issue is closed once and for all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step-By-Step Guide To Push Your First Project On GitHub!!
There are three steps :- · Step 1 : We need to add a file to staging area . · To check,if files...
Read more >
10 things I hate about Git - Steve Bennett blogs
Push your new branch ('git push origin my-new-branch') and log a pull request. ... git reset foo, Unstages files, git reset –hard
Read more >
git - Can't push to GitHub because of large file which I already ...
Hit Ctrl-C before proceeding to abort, then use an alternative filtering tool such as 'git filter-repo' (https://github.com/newren/git-filter-repo/) instead.
Read more >
EditorConfig
EditorConfig is a file format and collection of text editor plugins for maintaining consistent coding styles between different editors and IDEs.
Read more >
Authenticate with Firebase on Android using a Phone Number
You can use Firebase Authentication to sign in a user by sending an SMS message ... By using the Firebase Android BoM, your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found