0

I'm new to git and I would like to know what the proper setup would be for what I'm trying to do. Would I like to have branches on the server for each issue with my program and have each branch accessible by multiple users. I've tried using a bare repository, but then the branching is done on each person's own clone of the server. If I use a regular repository on the server, then I've had issues getting the local side to work.

I keep chasing my tail on this, so I would like some assistance from someone who knows git more than I do. I have git installed on a local server, not github or any other hosted git service.

kb9zzo
  • 3
  • 1
  • 3
  • The answers, particularly the top answer, is what I'm trying to do, but I don't see any instructions for how to do that. I'm struggling with the proper setup. Do I need to use a bare repo on the server side or just a regular repo? Etc. – kb9zzo Jan 29 '19 at 20:09
  • If you gonna use a central server to exchange commits you need a bare repo at the server. If you want to deploy pushed branches you probably also need non-bare repo and [a workflow](https://stackoverflow.com/a/54406048/7976758) to update them. – phd Jan 29 '19 at 21:22
  • take a look here, this may clarify the confusion: https://stackoverflow.com/questions/8382212/how-to-create-a-branch-in-a-bare-repository-in-git – Vlad Jan 29 '19 at 23:05
  • @Vlad, so I looked at your link and I was able to successfully push a local branch to the server. I think that may be the answer to what I needed. – kb9zzo Jan 31 '19 at 21:28

1 Answers1

0

the setup is not quite clear. do you have git repository on the server and then use it as a remote in relevance to your local repository which is cloned from the server, and so too other guys use it this way?

if so (and this would be a regular setup), each guy would just use git pull and git push for any of the branches; shouldn't cause a problem. Would be helpful if you clarify what exactly the problem is, under what configuration.

Vlad
  • 1
  • 1
  • 4
  • I guess it isn't so much that there is a problem, but I don't know the proper way to set it up. Currently I've got a server on the local network and then clone from that to my pc. I'm using bare repositories on the server, but that doesn't let me create branches on the server (I can on my PC's clone). – kb9zzo Jan 29 '19 at 16:37
  • To answer your first question, I do have the server setup as a remote for my local PC's repository that I can push my changes to. And I have one other person doing the same thing. Currently I don't really have a multi user setup because I haven't figured out what I need to do to make it work. – kb9zzo Jan 29 '19 at 16:39
  • I am still missing something. If your server is a central repository and is going to be used by many developers, you wouldn't work with it directly. you would rather clone the server's repository to your pc (and other developers will clone on theirs) and then you would use pull/push to communicate with the server. correct? so if this is what your intention is, what happens if you clone, then create a branch and do other changes, and then push it all back to the server? isn't this the way the branches have to be created in your configuration? – Vlad Jan 29 '19 at 22:43
  • From your comment it seems that you are trying to work with the server's repository directly, while this is not your intention, if I understand it correctly. You just need to clone and then use "git pull", "git branch", "git pull", etc. As long as your origin remote is setup correctly, all the changes and updates will always come form you or other developers, but nothing should happen directly on the server (after creating the central repository and the setup) - it's pull/push can take care of everything else, including branch management. – Vlad Jan 29 '19 at 22:46
  • I can successfully push changes to the server from my local clone. My trouble is that with a bare repository, I can't have multiple branches on the server so that I can share work with my other developer. I would like to have it so that when an issue arises, then I create a new branch for that issue and then the other developer and I can work on that branch and then push it back to the server and then do the merge. With my current setup/knowledge, I can only perform branching on the local level. – kb9zzo Jan 30 '19 at 15:32