同步git存储库,彼此之间无权访问,也无法从任何系统访问这两者 [英] Synchronizing git repositories without access to each other and no access to both from any system

查看:108
本文介绍了同步git存储库,彼此之间无权访问,也无法从任何系统访问这两者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们所处的团队分散,团队成员属于不同公司,因此无法访问彼此的服务器.我们正在进行一个项目,并且有一个需要同步的git存储库.团队的两个部分(出于简单起见,都称他们为A组和B组)都在进行更改.

We are in a situation with a distributed team where team members are of different companies and are not granted access to each other's servers. We work on one project and are having one git repository that needs to be synchronized. Both parts of the team (for reasons of simplicity calling them team A resp. B) are making changes.

  • 团队A有权访问服务器A,但不能访问服务器B
  • 团队B有权访问服务器B,但不能访问服务器A

我们没有可以同时访问两台服务器的系统,并且不太可能很快就可以访问该服务器.

We have no system that has access to both servers, and are not likely to get that anywhere soon.

我们如何使存储库在不同位置之间保持同步?

How do we keep the repository synchronized among the different locations?

到目前为止,我们一直在尝试以下方法,但收效甚微.

So far we have been trying the following approach(es) with little success.

团队A:

  • git clone --mirror https://server_a.com/repository_origin.git以获得完整副本,包括原始存储库中的所有分支和标签

  • git clone --mirror https://server_a.com/repository_origin.git to get a full copy including all branches and tags from the original repository

将生成的文件夹包装为zip文件,然后转移到B组

Wrap the generated folder in a zip file and transfer to team B

团队B:

  • 提取邮政编码

  • Extract zip

cd repository_origin.git

git remote set-url --push origin https://server_b.com/repository_mirror.git

方法

Approaches

    • git push --mirror导致完全删除了团队B的更改,但是团队A的所有更改都已合并到镜像存储库中,即,团队B的更改不在镜像存储库中.
    • git push --mirror results in the changes of team B to be completely discarded, but all of the changes of team A have been merged into the mirrored repository, i.e. team B changes are not in the mirrored repository.
  • git fetch --all正确获取了团队B的所有本地更改
  • git push --mirror的结果是没有更改,即团队A的更改不在镜像存储库中.
  • git fetch --all gets all the local changes of team B correctly
  • git push --mirror results in saying there are not changes, i.e. team A changes are not in the mirrored repository.

显然,我们还需要从团队B到原始存储库进行更改,但是如果没有从A到B的工作按预期进行,那么尝试使B到A的工作似乎没有太大用处.

Obviously we also need to get changes from team B to the original repository, but without the way from A to B working as desired it doesn't seem very useful to try to get B to A to work as desired.

因此,我们尝试了这些方法,但均无济于事.有谁知道如何解决这个问题?当然,我们希望每个人都在同一个原始存储库上工作,但由于目前和可预见的将来尚无规定,因此我们希望获得一个解决方案.

So we have tried these approaches, but neither worked. Does anyone have an idea how to address this? Of course we are hoping to get a solution with everyone working on the same original repository, but due to regulations that is not possible for now and the foreseeable future.

推荐答案

Git旨在支持通过电子邮件进行的全功能协作. Pro Git书中有本章讨论了,但基本上您可以使用 git format-patch 进行更改,发送将它们与 git imap-send 结合在一起,并在另一侧与 git am .同一本书的另一章包括简短示例.

Git was designed to support full-featured collaboration over email. The Pro Git book has a chapter discussing this, but basically you can generate changes using git format-patch, send them with git imap-send, and apply them on the other side with git am. Another chapter of the same book includes a short example.

这可能感觉技术含量低,但这是一种成熟的工作流程,对于

This might feel low-tech, but it is a mature workflow that has worked well for development of Git itself.

如果您的团队无法直接克隆存储库的初始副本,则可以使用git bundle生成捆绑包,然后进行克隆从那.

If your teams have no way to directly clone an initial copy of the repository you could generate a bundle with git bundle and then clone from that.

如果您不喜欢电子邮件流,也可以使用git bundle更新隔离的系统.一般来说,git bundle可能比手动压缩克隆更好.

If you don't like the email flow you can also use git bundle to update isolated systems. Generally speaking, git bundle is probably a better bet than zipping up clones manually.

这篇关于同步git存储库,彼此之间无权访问,也无法从任何系统访问这两者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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