仅在git中更新文件权限 [英] Updating file permissions only in git

查看:117
本文介绍了仅在git中更新文件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要将一个 some.sh 文件转换为可执行文件( chmod 755 ... ),权限分别为更新但不是内容。有没有办法将文件提交到git中,以便在 clone / checkout / 结帐时恢复/设置可执行位 /



更新:如何跟踪新权限提交给 github code>?

解决方案

默认情况下,git会更新文件权限。
$ b

如果在修改权限时没有看到任何更改,则可能在git中有一个忽略文件模式的配置。



您的项目在 .git 文件夹中为 config 文件,您应该看到如下所示:

  [core] 
filemode = false

您可以在您最喜爱的文本编辑器中将其更改为 true ,或运行:

  git config core.filemode true 

然后,你应该能够正常提交哟你的文件。它只会提交权限更改。


Just turned an some.sh file into an executable (chmod 755 ...), the permissions were updated but not the content. Is there a way to commit the file into git, so that the executable bit will be restored/set on clone / checkout / pull ?

Update: how can I track that the new permissions were submitted to github?

解决方案

By default, git will update file permissions if you change them.

If you don't see any changes when modifying permission, you probably have a configuration in git which ignore file mode.

Look into your project, in the .git folder for the config file and you should see something like this:

[core]
    filemode = false

You can either change it to true in your favorite text editor, or run:

git config core.filemode true

Then, you should be able to commit normally your files. It will only commit the permission changes.

这篇关于仅在git中更新文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆