我正在尝试使用 https://github.com/mgrp/django-distill 将 django 站点转换为静态站点。我将静态文件输出到
/e/ENVS/STATIC/static1
在我的win10本地系统上。当我进行更改时,我想覆盖所有非 stash 文件,包括 .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/
目录的写入权限?
最佳答案
您可以将 .git/
文件夹移到其他地方。
每当您需要处理该存储库时,请设置 the environment variables :
GIT_DIR=/path/to/saved/.git
GIT_WORK_TREE=/where/your/.git/was
输入 git status
时,您将受益于工作 Git 命令,即使您的部署过程覆盖了所有内容。
关于windows - 使用 git-bash 保护 .git 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52919013/