windows - 使用 git-bash 保护 .git 文件

标签 windows git git-bash static-site

我正在尝试使用 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/

相关文章:

c - INITCOMMONCONTROLSEX 未在此范围内声明

c - 为什么我无法创建此文件?

windows - Windows 批处理脚本中 SET/A 命令中使用的 & 符号

java - 如何在Python中检查Windows中 "start"命令启动的程序的输出?

git - 从远程删除大量分支

git - 撤消或删除先前 Git 提交的更改

Git:将最后 3 次提交放入分支,重置 master

windows - "Couldn' t 加载私钥(不是私钥)”使用 PuTTYgen 将 id_rsa.pub 转换为 ppk 时

git-bash - 当通过鼠标选择从 git-bash 窗口复制文本时,如何在 git-bash 中抑制 ^C(ctrl+C) 打印

git - Fatal : bad numeric config value for 'core.sharedrepository' in . git/config:无效单元(在 Git Bash 中)