如何最好地建立“中央”管理中心当前现有的本地git存储库中的git存储库? [英] How to best set up a "central" git repository from a current existing local git repository?

查看:110
本文介绍了如何最好地建立“中央”管理中心当前现有的本地git存储库中的git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道git是分布式的,坦率地说,我喜欢它的属性。

I know git is distributed, and frankly I like that property about it.

这种情况是我一直是我所开发软件的唯一开发者自git成立以来一直在我的本地存储上进行管理。一直如此-换句话说,当前仅存在一个存储库,我在其中提交和合并内容并将master分支保持在公共发行状态。

The situation is that I have been a sole developer of a piece of software that I have been managing by git since its inception, on my local storage. This has always been so - in other words, only a single repository exists currently, where I commit and merge stuff and keep the master branch in "public release" state.

我现在濒临放弃对该项目的专有控制权,并且将与其他开发人员共享其源代码,这些开发人员将自己进行更改。因此,我需要将我的项目副本分发给其他人。自然,我想继续做我的未来工作,并能够将其他工作复审并合并到我的副本中-据说创建了git的工作是。

I am now on the verge of giving up exclusive control of the project and will be sharing its source code base with other developer(s), who will be committing changes of their own. And so I need to distribute my copy of the project to others. Naturally, I would like to keep committing my future work and being able to review and merge others work back into my copy as well - a job git supposedly was created to do.

问题的一个方面是我的计算机和其他开发人员的计算机都不是公共的(即通过 ssh 或类似服务可以作为服务器访问)我很难想象将变更从他们的存储库副本中提取并合并到我的数据库中是多么可行,反之亦然。但是,该项目包括一台Intranet机器,我们可以将其用作存储库主机,在这一点上,我需要一些有关如何最好地进行设置的建议。

An aspect to the problem is that neither mine nor the other developers computers are public (i.e. will be reachable as servers by ssh or similar service) and I have trouble imagining how feasible it would be for me to pull and merge changes from their copy of the repository into mine, and vice versa. The project includes an intranet machine however, which we can use as a repository host, and at this point I need a piece of advice on how best to set this all up.

不应将任何开发人员(包括我自己)指定为该项目的仁慈独裁者,但是,为了管理起见,我将负责确保可以使用某种主版本或其他分支来检阅项目的公共发行版。但是我也不知道将要加入多少其他开发人员,即我们将拥有多少分布式副本,因此也许需要该存储库的中央 /主副本,我将自己撰写。

Neither of developers (including me) should be assigned as the benevolent dictator of the project, however, for the sake of management, I will be tasked with making sure that some sort of master or other branch is available to checkout public releases from. But I also don't know how many other developers will be joining, i.e. how many distributed copies we will have, and so perhaps a "central"/master copy of the repository will be needed, which I will solely author.

恐怕我在这里看不清全局。

I am afraid I cannot really see the big picture clearly here. How best to do this?

推荐答案

如果您的Intranet中已经有候选服务器,则使用它没有任何问题。只需在此处设置裸仓库,将现有仓库推入那里,然后开始将其用作中央仓库即可。这就是全部-没有独裁者,但是中央主机将是中央主仓库。

If you already have a candidate server in the intranet, there's nothing wrong with using that. Just set up a bare repo there, push the existing repo there and start using it as a central repo. That's all there is to it - there'd be no dictators, but the central host would be a central "master repo".

我知道这听起来像是传统的集中式模型,就是这样,但是我们已经使用git做了很多事情,它确实很好用。

I know it sounds like the traditional centralized model, and it is that, but we've been doing that a lot with git and it works really well.

如果您想让您的仓库成为主仓库,您可以只向其他人开放该主存储库,但可以有一个单独的生产分支或存储库。然后,您只需要从母版合并到生产分支/回购您已批准的内容即可。

If you want to have your repo as the master though, you could just open up that master repo to others, but have a separate production branch or a repo. Then, you'd only merge from master to production branch/repo the stuff you've approved of.

编辑:有关如何进行设置的实用说明的详细说明,示例此处。这里有指导,贯穿始终。我唯一要补充的是,对于第一次推送,您可能要使用 git push --all origin <,而不是 git push origin master 。 / code>而是推送所有分支,标签等,而不仅仅是主分支。

Practical instructions on how to do the setup are detailed for example here. There are instructions guiding all the way through. Only thing I would add is that instead of git push origin master, for the first push, you might want to use git push --all origin instead as that would push all branches, tags etc, and not just the master branch.

这篇关于如何最好地建立“中央”管理中心当前现有的本地git存储库中的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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