programing

Windows에서 Git 파일 사용 권한

instargram 2023. 5. 27. 09:37
반응형

Windows에서 Git 파일 사용 권한

Git의 파일 권한과 관련된 몇 가지 질문을 읽었는데 아직도 약간 혼란스럽습니다.GitHub에 대한 평판을 다른 것에서 갈라놨습니다.병합 후 동일해야 합니다.그러나:

$ git diff --summary origin/epsilon master/epsilon
 mode change 100644 => 100755 ants/dist/sample_bots/csharp/compile.sh
 mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/MyBot.coffee
 mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/ants.coffee
 mode change 100644 => 100755 ants/util/block_test.sh
 mode change 100644 => 100755 manager/mass_skill_update.py
 mode change 100644 => 100755 worker/jailguard.py
 mode change 100644 => 100755 worker/release_stale_jails.py
 mode change 100644 => 100755 worker/start_worker.sh

파일 권한을 변경해 보았지만, 변경 결과는 변경되지 않습니다.

Windows(윈도우)에서 권한을 변경하는 방법에 대한 솔루션을 찾았습니다. http://blog.lesc.se/2011/11/how-to-change-file-premissions-in-git.html

예를 들어, 다음 명령은 임의 파일에 사용자 실행 권한을 추가합니다.

git update-index --chmod=+x <file>

스택 오버플로에 대한 또 다른 질문:Git이 파일 모드(chmod) 변경을 무시하도록 하려면 어떻게 해야 합니까?

먼저 어떤 핵심인지 확인합니다.파일 모드가 -로 설정됩니다.

git config core.filemode

false로 설정해 보십시오.

git config core.filemode false

git-config(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.

Git Bash용 편리한 원라이너:

find . -name '*.sh' | xargs git update-index --chmod=+x

모든 것을 표시할 것입니다..sh파일을 실행 파일로 지정합니다.그 후에, 당신은 그냥.git commit.

Cygwingit(또는 Linux git)을 사용하면 코어가 될 가능성이 높습니다.파일 모드 설정이 $projdir/.git/config의 프로젝트 수준에서 설정되었습니다.Cygwingit과 Windows Git이 Windows 파일 시스템에서 항상 존재하지 않는 파일 모드 변경 없이 원활하게 공존하려면 다음 작업을 수행해야 했습니다.

  • 라인 설정 코어를 삭제합니다.$projdir/.git/config의 파일 모드
  • Windows git에서 "git config --global core"를 실행합니다.file mode false"

이를 통해 Cygwingit는 일반적으로 관련이 있는 파일 모드 변경을 계속 볼 수 있지만 Windows Git는 일반적으로 잘못된 긍정인 파일 모드 변경을 무시하도록 지시합니다.

먼저 아래 명령을 사용하여 파일 권한을 확인합니다.

git ls-files --stage

그런 다음 권한을 변경합니다.여기서 "x"는 실행 권한을 나타냅니다.

git update-index --chmod=+x 'scriptname.ext'

이제 사용 권한을 다시 확인합니다.

gits-files --stage

NB: Windows를 실행하고 Linux에서 배포하는 경우 저장소에 Unix와 유사한 줄 끝이 있는 코드가 포함되어 있는지 확인합니다.파일을 대량으로 변환하려면 다음을 시도할 수 있습니다.dos2unix.exeGit Bash에서 일할 수도 있습니다.

Ubuntu에서 파일 권한을 변경하고, 커밋하고, 푸시하고, 모두 OK하여 수정했습니다.Windows/NTFS의 msysgit에서는 작동하지 않는 것 같습니다.

저 같은 경우에는 실수로 쉐방 라인을 바꿔서.

#! /bin/sh

되었다

   #! /bin/sh

Git-bash 권한 검사에 실패합니다.선행 공백을 제거하면 스크립트가 다시 실행 가능하게 됩니다.

언급URL : https://stackoverflow.com/questions/6476513/git-file-permissions-on-windows

반응형