1

On GitHub if I want to contribute to another user's repo I clone it, make changes and submit a PR, at which point the owner can choose to merge or not. I am trying to figure out how to create a similar flow with a private Git server.

We have a Git repo at work that I do 90% of the work on, but occasionally my co-worker will make changes and for whatever reason he refuses to tell me when he does, which results in frustrating conflicts and lost time.

As far as I can tell from Googling, there can only be one user listed in git-config.. am I understanding this point correctly? How can I achieve a workflow as described in the first paragraph?

  • What is your issue? Is it with the workflow for your coworker or is it with configuring the git server? – marstato Aug 29 '18 at 13:52
  • @marstato the former, I was trying to solve with the latter.. – I wrestled a bear once. Aug 29 '18 at 14:20
0

There can be only one user listed in the local git config. Correct. But this does not mean that you cannot have multiple repository owners. When you create a project in GitHub, GitLab or any other git repository, you can have multiple collaborators and also different roles for the project collaborators.

So for example, if you are loosing a lot of time to resolve the conflits and merge the code of your co-worker, then you can give him the rights so that he can also do this job.

For me personally, the best way is not to Clone a project, but rather, to force all the collaborators to Fork the project. In this way, they will first have to commit and merge the changes to their own Master first, before making a merge request to the Project Master. This flow is safer, and easier to control.

Either way, is a matter communication and you guys as a team need to talk and decide the best way to organize your flow of development.

I also recommend you to take a look at Gitflow, which is a great tool to collaborate as a team using Git.

https://www.atlassian.com/git/tutorials/comparing-workflows

  • 2
    Gitflow is fairly complicated; that complexity is probably only justified for large software projects and teams. – Robert Harvey Aug 27 '18 at 16:44
  • Another thing, as Christophe mentioned above, every user can have his/her own user in his/her local config. Don't mistake Git for GitHub. Here you can find the more about this: stackoverflow.com/questions/13321556/… – Jason Canto Aug 27 '18 at 16:50
  • 1
    thanks.. what i'm taking away from this is that i need to give him his own user on the OS first.. currently there's just one user account on that server called "git." thanks for clearing that up for me. – I wrestled a bear once. Aug 27 '18 at 16:54
  • 1
    Both you and your coworker are using a single machine with a single account to do all development work ? – TurtleKwitty Aug 27 '18 at 20:29
  • @Occam'sRazor you should probably go ahead and set yourself up with a legit login while you’re at it. – RubberDuck Aug 28 '18 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.