为3人团队设置Git? [英] Setting Git for a team of 3 people?

查看:72
本文介绍了为3人团队设置Git?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这篇文章旨在总结所有信息,为比赛中的3人建立一个封闭的存储库。请随意向列表中添加一个我没有注意到的问题。请将每个问题的答案作为单独的答案添加。


  1. 情况A:草稿和文件可以交换3人之间。
    编写器只能将文件推送到
    存储库。
  2. 情况B:与上述类似,但所有团队成员都可以推送文件到仓库。

关于情况A的一般问题




  • 如何为A,B和C人设置远程分支机构,以便团队成员可以查看其团队成员想要共享的文件?

  • 如何将人员A设置为独裁者,只能将更改推送到神圣的存储库?



有关情况A的初始问题


  1. 你如何设置一个Git仓库,人们可以把A,B和C拉出来? 我认为Git已经成功安装到版本库中了。

  2. 您如何才能让作者只能推送?

关于两种情况的高级问题




解决方案



听起来你想要设置一个集成管理器工作流程。在这种情况下,人员A创建了一个初始存储库,它是神圣的存储库。每个人,A,B和C克隆存储他们的个人工作。当人B或C有想要A包含在共享库中的东西时,他们将它提交到它们的本地存储库,并要求A从它的存储库中取出(拉取请求);人A为人员B和人员C的存储库设置 remote ,然后可以 git pull personB 或 git pull personB 在合并中进行更改。 Person A然后 git push 将合并后的更改合并到神圣的存储库中。



您可以设置克隆和推送通过各种运输。最简单的就是通过ssh使用git协议。例如,


  1. Person A创建了神圣的存储库:请参阅 37signals的页面。假设它位于 sharedhost 中的 /local/git/project.git 中。您可以省略 - shared = group ,因为您希望它成为集成存储库。 (这里写访问权限是使用Unix文件权限保护的。)
  2. 在主目录中,人员A,B和C克隆该存储库。

      cd〜/ src 
    git clone ssh://sharedhost//local/git/project.git
    cd project#编辑文件这里。
    git commit


  3. Person A为B和C的存储库设置远程控制。 / p>

      git remote add personB ssh:// sharedhost /〜b / src / project 
    git remote add personC ssh:/ / sharedhost /〜c / src / project


  4. 现在人A可以 git pull personB 来获取B的变化。当A很高兴的时候,他会 git push 将新合并的更改推送到共享仓库,B和C可以 git pull 例如 GitHub 为您处理所有共享的git存储库。他们也可以帮助他们解决问题。
    对于我来说,我发现最棘手的部分是理解提交流程。一旦你明白了,事情就会变得更有意义。此 gitready.com上的讨论可能有助于澄清事物为你。还有一个截屏视频,涵盖了类似的内容。


    The post aims to summarize all pieces of information to set up a closed repository for 3 people in a competition. Please, feel free to add a problem to the list which I have not noted. Please, add each answer to each question as a separate answer.

    1. Situation A: Drafts and files can exchange between 3 people. The writer can only push files to the repository.
    2. Situation B: Similarly as above, but all team mates can push files to the repository.

    The general problems about Situation A

    • How can you set up remote branches for people A, B and C, so that team members can see files which their team members want to share?
    • How can you set up the person A as a dictator, who can only push changes to the sacred repository?

    Initial Problems about Situation A

    1. How can you set up a Git repository, where people A, B and C can pull? I assume Git is already successfully installed to the repository
    2. How can you allow the writer only push?

    Advanced Problems about both Situations

    解决方案

    Situation A

    It sounds like you want to set up a integration manager workflow. In this scenario, person A creates an initial repository which is the sacred repository. Each person, A, B and C, clones that repository for their personal work. When person B or C has something they want A to include in the repository for sharing, they commit it to their local repository, and ask A to pull from their repository (a pull request); person A sets up remotes for person B's and person C's repositories and then can git pull personB or git pull personB to merge in the changes. Person A then git pushs the merged changes into the sacred repository.

    You can set up the cloning and pushing over a variety of transports. The easiest is to use the git protocol over ssh. e.g.,

    1. Person A makes the sacred repository: see 'Creating a remote repository' at this page from 37signals. Let's say it is in /local/git/project.git on sharedhost. You can leave out the --shared=group since you want it to be an integration repository. (Write access here is protected using Unix file permissions.)
    2. Person A, B and C, in their home directories, clone that repository.

      cd ~/src
      git clone ssh://sharedhost//local/git/project.git
      cd project # edit files in here.
      git commit
      

    3. Person A sets up remotes for B and C's repositories.

      git remote add personB ssh://sharedhost/~b/src/project
      git remote add personC ssh://sharedhost/~c/src/project
      

    4. Now person A can git pull personB to fetch B's changes. When A is happy, he will git push to push the newly merged changes to the shared repo and B and C can git pull to fetch them.

    If setting up the repositories sounds a bit complex, you may want to pay a provider such as GitHub to handle all the hosting of shared git repositories for you. They also have support where they can help you out with problems. For me, I found that the trickiest part is understanding the flow of commits. Once you get that, things start to make more sense. This discussion at gitready.com might help clarify things for you. There is also a screencast that covers similar material.

    这篇关于为3人团队设置Git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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