unity project를 gitbash로 add했는데 아래와 같은 에러가 발생했다.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/EditorBuildS
ettings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/EditorSettin
gs.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/GraphicsSett
ings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/InputManager
.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/NavMeshAreas
.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/PackageManag
erSettings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/Physics2DSet
tings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/PresetManage
r.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/ProjectSetti
ngs.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/ProjectVersi
on.txt.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/QualitySetti
ngs.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/TagManager.a
sset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/TimeManager.
asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/UnityConnect
Settings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/VFXManager.a
sset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/VersionContr
olSettings.asset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in ProjectSettings/XRSettings.a
sset.
The file will have its original line endings in your working directo
ry
warning: LF will be replaced by CRLF in UserSettings/EditorUserSetti
ngs.asset.
The file will have its original line endings in your working directo
ry
error: open("Bowling/Temp/UnityLockfile"): Permission denied
error: unable to index file 'Bowling/Temp/UnityLockfile'
fatal: adding files failed
구글링해보니 CRLF 문제 즉 줄바꿈이 문제인듯하여 아래 코드를 터미널에 입력해주었다.
git config --global core.autocrlf true
Git은 커밋할 때 자동으로 CRLF를 LF로 변환해주고 반대로 Checkout할 때 LF를 CRLF로 변환해 주는 기능이 있는데 core.autocrlf 설정으로 이 기능을 켤 수 있다. 윈도우에서 이 값을 true로 설정하면 Checkout할 때 LF 문자가 CRLF 문자로 변환된다.
여기서 줄바꿈 에러가 나는 이유는 윈도우 계열과 유닉스(맥, 리눅스) 계열에서의 서로 다른 플랫폼에서의 공유시 발생하는 소스의 줄바꿈때문이다. 윈도우는 줄 바꿈 문자로 CR(Carriage-Return)과 LF(Line Feed) 문자를 둘 다 사용하지만, Mac과 Linux는 LF 문자만 사용한다. 크로스 플랫폼 프로젝트에서는 이것이 꽤 성가신 문제가 된다.
하지만 에러는 해결되지 않았다.
문제는 해당 프로젝트를 add할 때 유니티 프로젝트와 스크립트 파일을 작성하는 visual studio code를 열어 놓아서 발생한 문제였다. 두 개를 닫고 add하니 문제는 간단히 해결되었다.