【问题标题】:Protect .git file with git-bash使用 git-bash 保护 .git 文件
【发布时间】:2018-10-21 19:24:17
【问题描述】:

我正在尝试使用 https://github.com/mgrp/django-distill 将 django 站点转换为静态站点。我将静态文件输出到

/e/ENVS/STATIC/static1

在我的 win10 本地系统上。当我进行更改时,我想覆盖所有非隐藏文件,包括 .git 目录、提交并将更改推送到我的 github 存储库以进行部署。不幸的是, distill 项目覆盖了整个目录,删除了 .git/ 文件。我试图用

保护 git 文件
$ chmod -R 707 .git/ 

使用 git-bash,但输出如下:

drwxr-xr-x 1 me 197121     0 Oct 21 14:35 ./
drwxr-xr-x 1 me 197121     0 Oct 20 17:11 ../
drwxr-xr-x 1 me 197121     0 Oct 21 14:35 .git/
drwxr-xr-x 1 me 197121     0 Oct 21 14:36 .idea/
-rw-r--r-- 1 me 197121  9963 Oct 21 15:02 agreement.html
-rw-r--r-- 1 me 197121    17 Oct 21 15:02 contact.html
-rw-r--r-- 1 me 197121 14027 Oct 21 15:02 documents.html
-rw-r--r-- 1 me 197121 17048 Oct 21 15:02 form.html
-rw-r--r-- 1 me 197121 11060 Oct 21 15:02 index.html
-rw-r--r-- 1 me 197121  4921 Oct 21 15:02 slideshow.html
drwxr-xr-x 1 me 197121     0 Oct 21 15:02 static/

如何打开和关闭.git/ 目录的写入权限?

【问题讨论】:

    标签: windows git git-bash static-site


    【解决方案1】:

    您可以将.git/ 文件夹移到别处。

    每当您需要处理该存储库时,请设置 the environment variables:

    GIT_DIR=/path/to/saved/.git
    GIT_WORK_TREE=/where/your/.git/was
    

    输入git status 时,您将从有效的 Git 命令中受益,即使您的部署过程会覆盖所有内容。

    【讨论】:

      猜你喜欢
      • 2014-03-03
      • 1970-01-01
      • 2013-08-07
      • 1970-01-01
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      • 2012-02-16
      • 2022-01-26
      相关资源
      最近更新 更多