连接`.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.
更多推荐
发布评论