Github list files as binary even though .gitattributes is set to -crlf diff and diff is shown properly on local

StackOverflow https://stackoverflow.com/questions/16192551

Question

I have a repo with files that are encoded as UCS-2 by default. They're actually plain ASCII, but they are created by TestComplete tool and automatically set to that encoding. I tried many variants for setting those files to be text explicitly. I ended up with following string in .gitattributes file:

*.sj -crlf diff

(*.sj files are actually JS files for TestComplete) I can diff files ok (at least after git checkout HEAD --force . for the whole repository), i commit and see eg. 1 file changed, 2 insertions(+), 1 deletion(-) but when i do git push and try to view commits on GitHub they are shown as binary. I've seen many threads about setting vimdiff and such, but the problem seem to emerge somewhere else as i can see diffs, but github doesn't. And i use git on Windows.

What is wrong with my setup? What should i do to make github and git understand that .sj files are all text files and how can i make all those changes to take effect for all already added files?

EDIT: What i want is make git and github understand that those files are text ones and should be treated as that, even though previously they were considered binary. How to setup git/github?

Was it helpful?

Solution

You can make TestComplete save these files in ANSI. To do this, open the TestComplete project containing these files, open the project settings window (Tools | Current Project Properties) and set the ANSI value for the Units encoding option in the General section. After this, save the project (File | Save All).

Also, you can save the files in the ANSI encoding from Notepad. Just open a file in Notepad and save is using the Save As dialog (File | Save As). You can choose the desired encoding in the Enconding combo box in this dialog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top