简体   繁体   English

git change权限在下一次提交之前无法持久

[英]git change permission failed to persist before next commit

I need to set the permission of script.sh to 755 . 我需要将script.sh的权限设置为755 So 所以

git add -A
git update-index --chmod=+x script.sh
git commit -m 'first commit'

This way the file will be committed with a permission 755 and my remote vm can execute those scripts. 这样,文件将以权限755提交,我的远程vm可以执行那些脚本。

However, next time I do something to the repo and commit the changes the permission of those scripts will be reverted to 644 . 但是,下次我对存储库执行某些操作并提交更改时,这些脚本的权限将恢复为644 The message is 消息是

[master 171c0cc] second
 2 files changed, 1 insertion(+)
 mode change 100755 => 100644 script.sh

Anyone know what might be happening here? 有人知道这里会发生什么吗? How do I get rid of this? 我该如何摆脱呢?

First check your git config core.fileMode : if it is set to false, the executable bit of files in the working tree won't be honored anyway. 首先检查您的git config core.fileMode :如果将其设置为false,则无论如何都不会接受工作树中文件的可执行位。

If it is true or not set, then try a chmod . 如果为true或未设置,请尝试使用chmod

Then try also to set core.sharedRepository to group . 然后尝试core.sharedRepository设置为group
And check your umask. 并检查您的umask。 umask 002 in your case should work. 您的情况下的umask 002应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git:提交前快速查看差异 - Git: fast diff viewing before commit 在Linux中更改权限为0666的文件的所有权失败 - Failed to change ownership of a file with permission 0666 in Linux 查看当前分支中特定提交 ID 之前的 Git 历史记录 - View Git history before a specific commit ID in the current branch 由于权限问题,Windows中使用ssh的git clone失败 - git clone using ssh failed in Windows due to permission issue 无法将文件添加到 git 存储库,但可以更改/提交 - can't add file to git repository but can change / commit SVN提交权限被拒绝 - SVN commit permission denied Git:索引文件打开失败:“git status”的权限被拒绝。 托管在 Bitbucket 上 - Git: index file open failed: Permission denied on “git status”. Hosted on Bitbucket git 未安装无法启动 Git 进程:无法运行程序“/usr/lib/git-core”(在目录“.”中):错误 = 13,权限被拒绝 - git is not installed Failed to start Git process: Cannot run program "/usr/lib/git-core" (in directory "."): error=13, Permission denied 如何在提交之前从git add中删除某种类型的文件和目录? - How to remove a certain type of files and directories from git add before commit? GPG 未能签署 git 提交的数据。 但它首先签署本地文件后工作? - GPG failed to sign the data for a git commit. But it works after signing a local file first?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM