在 git 中从另一个远程跟踪远程存储库
天哪,有很多已回答的问题,但我不确定其中任何一个。
先决条件:
- 我的项目在 github 上有主存储库。
- 我的项目在 sourceforge 上也有存储库
预期结果:
- 在开发过程中,我正在推送到我的 github 存储库(简单的 git 推送)。
- 有人正在克隆 sourceforge 存储库(简单的 git 克隆)。
- 有人正在将他的更改推送到 sourceforge 存储库(简单的 git 推)。
- sourceforge 和 github 仍然保持同步。
问题:
- 是否可以配置这样的东西?
- 我不需要备份。如果 sourceforge 不必从 github 获取/发送任何数据(这样他们就不必浪费资源),那就太好了。因此,一般来说,sourceforge 应该提供某种指向 github 存储库的链接,并且应该在初始 git clone 时自动访问该链接。
抱歉,我在这个主题上添加了一个新问题,但我太困惑该使用什么,它是否有效,最重要的是 - 它是否不会在我的存储库中造成混乱。我希望这会类似于远程跟踪存储库:)
Gosh, there are so many answered questions but i'm not sure about any of them.
Prerequisites:
- My project has main repository on github.
- My project has repository on sourceforge as well
Expected results:
- While developing i am pushing to my github repository (simple git push).
- Someone is cloning sourceforge repo (simple git clone).
- Someone is pushing his changes to sourceforge repo (simple git
push). - Both, sourceforge and github are still in sync.
Questions:
- Is it possible to configure something like this?
- I don't need backup. It would be good if sourceforge wouldn't have to fetch/send any data from/to github (so they wouldn't have to waste resources). So, generally - sourceforge should provide some kind of link to github repository, and this link should be automatically accessed at initial git clone .
Sorry, i'm adding a new question on this topic but i'm too confused what to use, if it will work, and most importantly - if it wont make a mess in my repo. I expect this would be something like remote tracking repo :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确实没有一个好的方法可以做到这一点,不。也许只是从您的项目的 Sourceforge 页面提供一个指向 Github 的链接?
There isn't really a good way to do this, no. Perhaps just provide a link to Github from your project's Sourceforge page instead?
它无法自动化的原因是您有可能引入只有人类才能解决的冲突。如果你真的想让它们保持同步,人类就必须从两者中拉出来,解决任何冲突,然后推动两者。或者,您可以将其中一个存储库设置为只读,以便其他人可以从中提取数据,但只有一个人可以推送,从而消除了潜在的冲突。但是,除非您有充分的理由保留其副本,否则我建议您关闭其中一个帐户。
The reason it can't be automated is that you have a potential to introduce conflicts that only a human can resolve. If you really want to keep them in sync a human will have to pull from both, resolve any conflicts, and then push to both. Alternately, you could make one of the repositories read-only, so other people can pull from it, but only one person can push, which eliminates the potential for conflict. However, unless you have a really good reason for keeping it duplicated, I would recommend closing one of the accounts.