Git: broken character encoding in cloned project

862 views Asked by At

My goal: I want to to clone repository from Bitbucket using Git(Sourcetree).

My problem: I am able to finish cloning, but some source files in local project have broken encoding.

All files in repository are fine, the problem is only local, even if my team is using .gitattributes, which should override any local settings.

In .gitattributes EOL conversions are disabled by default.

Example:

Server:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; ...

Local:

using System.Collections;
਍甀猀椀渀最 匀礀猀琀攀洀⸀䌀漀氀氀攀挀琀椀漀渀猀⸀䜀攀渀攀爀椀挀㬀ഀഀ
using UnityEngine;
਍甀猀椀渀最 唀渀椀琀礀䔀渀最椀渀攀⸀唀䤀㬀ഀഀ

Note: while cloning, I got "template files not found" warning. Also default encoding in sourcetree is set to UTF8.

Do you have experience with this kind of problem or any suggestions how to fix this?

SOLVED: Git was actually converting LF to CRLF all the time. I had to disable conversions in .gitconfig and explicitly set EOL to LF.

[core]
    eol = lf
    autocrlf = false
    safecrlf = false
0

There are 0 answers