우분투와 데비안에서 나중에 커밋 한 파일은 나중에 체크 아웃을 시도 할 때 실행 비트가 설정됩니다. 꽤 이상하고 나를 미치게합니다.
$ ls -l file
-rw-r--r-- ... file
# on branch master:
$ git commit -m 'mode is 644' file
[master 0123456] mode is 644
1 files changed, 1 insertions(+), 1 deletions(-)
# All ok
$ git checkout dev-branch
Switched to branch 'dev-branch'
# Seemingly all ok, but file now has the exec bit set
$ git merge master
Updating 6543210..0123456
error: Your local changes to 'file' would be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.
# Oops...
$ ls -l file
-rwxr-xr-x ... file
실행 비트가 언제, 왜 미끄러지는지 아는 사람이 있습니까? core.filemode
로 설정되어 true
있습니다.
분기 전환 중에 vim에서 파일을 열었습니다. 어쨌든 중요합니다.
부록 1 : 권한이 강화 된 체크 아웃입니다. 나는 계속해서 게임을 할 수 있습니다.
$ git br
* master
dev-branch
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
$ chmod 644 file
$ git diff
$ git checkout dev-branch
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
$ chmod 644 file
$ git diff
$ git checkout master
$ git diff
diff --git a/file b/file
old mode 100644
new mode 100755
# ...and so on ad inf.
부록 2 : 그건 그렇고,이 저장소의 모든 파일에 대해 내가 저지른 일입니다. 성공적인 커밋 후에는 권한을 부여하지 않으면 분기를 전환 할 수 없습니다.
답변
Git 사용자는 아니지만 Git은 전체 파일 권한 마스크를 저장한다고 생각합니다.
즉, 한 번 파일을 실행 파일로 설정 했으므로 Git이 저장소에서 선택하여 복제했습니다. 따라서 커밋하기 전에 파일의 권한 마스크 자체를 변경해야합니다.
Git이 그러한 변경을 무시하도록하려면
git config core.filemode false
에서 자식-설정 (1) :
core.fileMode
If false, the executable bit differences between the index and the
working copy are ignored; useful on broken filesystems like FAT.
See git-update-index(1). True by default.
답변
커밋 또는 체크 아웃 중에 실행되는 사용자 지정 후크가 있는지 확인 했습니까? 파일을 변경하는 일부 사용자 정의 후크가있을 수 있습니다. 체크 아웃 githooks 맨 페이지를 .
후크는 기본적으로 특정 이벤트 (커밋, 체크 아웃 등)에서 git이 호출하는 작은 프로그램입니다.
답변
분기 dev-branch에서 git commit -m ‘mode is 644’파일을 사용해 보셨습니까?
나에게 그것은 일어나고있는 것처럼 보입니다 .main에 대한 권한을 변경 한 다음 잘못된 권한이있는 dev 분기를 풀고 로컬 권한을 방해합니다. 그런 다음 다시 커밋하려고합니다. 복제, 변경, 커밋, 병합 중 하나; 또는 하나의 파일 커밋을 사용하여 파일을 개별적으로 변경하여 dev로 병합 한 다음 병합하십시오.
답변
이 링크에는 좋은 답변이 있습니다.
/programming/9027584/how-to-change-the-file-mode-on-github
과
/programming/1611211/how-do-i-make-git-accept-mode-changes-without-accepting-all-text-changes
기본적 git update-index --chmod=(+|-)x <file>
으로 변경 사항이 추가되면 커밋하고 푸시하여 권한을 추가 / 제거해야합니다.