Read only permission for file on git

时间:2019-01-18 19:12:28

标签: git chmod git-push git-add

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

1 个答案:

答案 0 :(得分:2)

Git仅支持一个权限位:“可执行”(mode 100755)或“不可执行”(mode 100644)。这是一个有意的选择-早期的Git都提供了更多支持,结果证明效果不佳。

您需要在签出后对文件进行chmod修改,也许是通过一个或多个钩子。