【问题标题】:File permissions restore in Git在 Git 中恢复文件权限
【发布时间】:2016-03-20 21:34:47
【问题描述】:

以下是要求:

  1. 创建文件 test.sql ,将权限设置为 –rwxr-xr-- 即此处 所有者和组具有可执行文件。假设文件被推送到 源代码管理

  2. 当我想从源代码控制下载文件时 应该保留权限,因为它是---rwxr-xr--

当我从存储库中提取文件时使用 Git,我会看到权限 –rwxr-xr-x 即其他人具有我不会的可执行权限 需要。

权限也应该在开发中保留。

请告诉我存档时如何保留权限。
我在论坛上看到了几个答案,但我不知道应该实施哪一个,
git钩子?脚本?

【问题讨论】:

    标签: git file permissions hook executable


    【解决方案1】:

    您可以使用this gist

    您将文件和目录的权限存储在名为 .git_cache_meta 的单独文件中,而不是直接在 git 下。

    可以在here找到完整的示例

    从上面的帖子复制:

    +# git bundle create mybundle.bdl master; git-cache-meta --store
    +# scp mybundle.bdl .git_cache_meta machine2: #then on machine2:
    +# git init; git pull mybundle.bdl master; git-cache-meta --apply
    

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 2015-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-21
      • 1970-01-01
      • 1970-01-01
      • 2010-10-12
      相关资源
      最近更新 更多