简体   繁体   English

如何在没有中央存储库的情况下设置git?

[英]How do I setup git with no central repository?

Three of us in the office are on Mac laptops and we use git day to day. 办公室里的三个人都在Mac笔记本电脑上,我们每天都使用git。

We want to share a repo with each other without setting up a central repo. 我们希望彼此共享一个回购,而无需设置中央回购。

Dave pushes to Sally who pushes to Chandu. 戴夫推着推向Chandu的Sally。

Chandu can pull from Sally and Dave. Chandu可以从Sally和Dave拉出来。

Is there a good way to do this? 有没有办法做到这一点?

It is perfectly compatible with the "Decentralized" notion of a DVCS like Git, and very easy to setup (all you need is sharing paths between the repos) 它完全兼容像Git这样的DVCS的“分散式”概念,并且非常容易设置(所有你需要的是在回购之间共享路径)

The only issues to address are: 唯一需要解决的问题是:

  • the workflow of merges you need to follow (how do you manage public branches -- "public" as in pushed/pulled from one repo to another). 您需要遵循的合并工作流程(如何管理公共分支 - “公共”,如从一个仓库推送/拉回到另一个仓库)。
    See for instance this SO question , or that one . 例如,参见这个SO问题 ,或者那个 问题
  • the necessity to push to a bare repo , meaning each programmer must have two repo: one public where other push to (a bare repo), and one private, cloned of the first, from which he/she can push to other. 推动一个裸仓库的必要性,意味着每个程序员必须有两个回购:一个公开,其他推送(一个裸仓库),一个私人,克隆第一个,他/她可以推送到其他。
    That way you do not need to setup only one "central bare repo, but you can truly push to anyone you want. 这样你就不需要只设置一个“中央裸仓”,但你可以真正地推送给你想要的任何人。

Just pull from each other :) 只是互相拉扯:)

Instead of pushing, just make a pull request (verbally, on IRC, or however you want); 而不是推动,只需提出拉动请求(口头上,在IRC上,或者你想要的); ask people to pull from you. 请人们拉你。

What you need to do is to setup a bare remote git repo. 你需要做的是设置一个裸的远程git仓库。 Check instructions here. 检查说明。

http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository

If you want to be able to push to/pull from each other while offsite, you're going to need some kind of VPN so your laptops can talk to each other. 如果您希望能够在异地之间相互推送/拉动,那么您将需要某种VPN,以便您的笔记本电脑可以相互通信。 It might be easier to set up a remote repository (or a set of them, one each) on a server somewhere, because that deals with the laptops being offline when you want to merge. 在某个地方的服务器上设置一个远程存储库(或一组,每个一个)可能更容易,因为它可以处理要合并时笔记本电脑处于脱机状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM