连接`.git`目录进行构建有任何危险吗?(Any danger in linking `.git` directory for a build?)

编程入门 行业动态 更新时间:2024-10-27 21:17:20
连接`.git`目录进行构建有任何危险吗?(Any danger in linking `.git` directory for a build?)

我正在设置一个通用的git部署环境,我想知道在.git目录中设置符号链接是否安全? 通过这样做,我希望能够从同一个仓库中进行单独检查,而无需拥有潜在大型项目历史的本地副本。

推理(伪流):

网页界面: 单击“将此提交部署到此服务器” 服务器: ln -s ./deploy/.git ./build/.git cd build git fetch git checkout some_commit make 如果成功: cd .. mv build deploy make deploy //只需重置nginx,apache等 如果失败 提醒用户 擦除构建目录,没有伤害

I'm setting up a general git deployment environment and I'm wondering if it's safe to set up a symlink to a .git directory? By doing so, I'm hoping to be able to have seperate checkouts from the same repo without having to have to local copies of the history of a potentially large project.

Reasoning (pseudo-flow):

web interface: click "Deploy this commit to this server" server: ln -s ./deploy/.git ./build/.git cd build git fetch git checkout some_commit make if success: cd .. mv build deploy make deploy // just reset nginx, apache, etc if failure alert user wipe build directory, no harm done

最满意答案

查看git-new-workdir ,这是一个专门用于从一个.git目录中检出多个工作目录的工具。

Check out git-new-workdir, a tool purpose-built for checking out multiple working directories from one .git directory.

更多推荐

本文发布于:2023-07-28 04:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1300344.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有任何   危险   目录   git   build

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!