gpt4 book ai didi

linux - 在无法访问的服务器上自动部署 git

转载 作者:太空宇宙 更新时间:2023-11-04 12:57:06 26 4
gpt4 key购买 nike

我有几台服务器无法通过 SSH 或 HTTP 直接访问,但它们能够连接到互联网。

我想找到一种通过 git 自动部署更新的聪明方法。我可以做一个定期执行 git pull 的脚本,但这似乎不是最好的方法。

在这种情况下管理 git 部署的最佳方式是什么?

最佳答案

你可能想看看“git bundle”

我以前在“气隙”系统中使用过它。

git bundle create <file> <git-rev-list-args>

git bundle verify <file>

创建 bundle 后,您可以对 bundle 使用“git clone”或“git pull”。

这是来自“bundle”的手册页:

Some workflows require that one or more branches of development on one machine be replicated on another machine, but the two machines cannot be directly connected, and therefore the interactive Git protocols (git, ssh, rsync, http) cannot be used. This command provides support for git fetch and git pull to operate by packaging objects and references in an archive at the originating machine, then importing those into another repository using git fetch and git pull after moving the archive by some means (e.g., by sneakernet). As no direct connection between the repositories exists, the user must specify a basis for the bundle that is held by the destination repository: the bundle assumes that all objects in the basis are already in the destination repository.

关于linux - 在无法访问的服务器上自动部署 git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35420606/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com