Search code examples
gitchmodgit-pushgit-add

Read only permission for file on git


I am trying to give permission 400 to a file on git and try to commit the same. But is trying to commit with permssions as " create mode 100644 "

Is it possible to commit file with 400 permissions in git or should I git clone and handle permission change in my code


Solution

  • Git supports only one permissions bit: "executable" (mode 100755) or "not executable" (mode 100644). This was a deliberate choice—very early Git supported more, and it turned out not to work well.

    You will need to chmod the file after checkout, perhaps through one or more hooks.