Setting Git for a team of 3 people?

后端 未结 4 466
北恋
北恋 2021-01-30 03:21

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

4条回答
  •  日久生厌
    2021-01-30 04:17

    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.

提交回复
热议问题