How do I make Git ignore file mode (chmod) changes?

后端 未结 11 1380
天命终不由人
天命终不由人 2020-11-22 02:29

I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo.

Git pick

11条回答
  •  不知归路
    2020-11-22 02:41

    If you have used chmod command already then check the difference of file, It shows previous file mode and current file mode such as:

    new mode : 755

    old mode : 644

    set old mode of all files using below command

    sudo chmod 644 .

    now set core.fileMode to false in config file either using command or manually.

    git config core.fileMode false
    

    then apply chmod command to change the permissions of all files such as

    sudo chmod 755 .
    

    and again set core.fileMode to true.

    git config core.fileMode true
    

    For best practises don't Keep core.fileMode false always.

提交回复
热议问题