切换远程 git 存储库中的分支

发布于 2024-12-22 20:54:01 字数 247 浏览 2 评论 0原文

当我部署生产代码时,我只需执行“git推送生产” - 我有一个接收后挂钩可以执行以下操作:

“git checkout -f” - 这将使用最新的推送更新我们的生产代码。

在这种情况下,我希望我们的生产存储库位于另一个分支中,有什么方法可以通过钩子或从本地计算机发送到远程存储库的命令来做到这一点?

我问这个是因为我想限制对实时服务器的访问。目前完成此操作的方法是我们 ssh 到实时服务器,然后执行“git checkout .

when i deploy production code i simply do "git push production" - i have a post-receive hook that does this:

"git checkout -f" - that will update our production code with the latest push.

In this case, i'd like our production repo to be in another branch, is there any way to do that from a hook or a command from a local machine send to the remote repo?

I'm asking this because I'd like to restrict access to the live server. Currently the way this is done is we ssh to the live server, and do "git checkout .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柳若烟 2024-12-29 20:54:01

您可以在接收后挂钩中执行您喜欢的任何脚本。
现在-访问,您最多可以使用SSH公钥身份验证。

You can execute whichever script you like in post receive hook.
Now - access, you may use SSH public key auth at best.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文