切换远程 git 存储库中的分支
当我部署生产代码时,我只需执行“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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在接收后挂钩中执行您喜欢的任何脚本。
现在-访问,您最多可以使用SSH公钥身份验证。
You can execute whichever script you like in post receive hook.
Now - access, you may use SSH public key auth at best.