我在两个不同的系统中有一个远程存储库和两个远程存储库 [英] I have one remote repository and two remote repos in two different systems

查看:39
本文介绍了我在两个不同的系统中有一个远程存储库和两个远程存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在两个不同的系统中有一个远程存储库和两个远程存储库.

I have one remote repository and two remote repos in two different systems.

在一个系统中,我将修改代码并将其推送到远程存储库.
如何使用git hooks自动更新另一个本地存储库中的代码?

In one system, I will modify and push the code to a remote repo.
How can I update the code in another local repo automatically using git hooks?

推荐答案

如果您有一个本地存储库推送到一个远程存储库,并且想要更新另一个远程存储库,则需要设置一个例如此答案)

If you have one local repo pushing to a remote repo, and want a second remote repo to be updated, you need to set a post-update hook in the first remote repo (as in this answer for instance)

ssh git@firstRemoteRepoServer
cd /path/to/remote/repoA.git/hooks (#bare repository)
git remote add B /url/to/remote/bare/repoB.git
echo "git push --mirror B" > post-receive
chmod 755 post-receive

这篇关于我在两个不同的系统中有一个远程存储库和两个远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆