Reputation: 12538
If I am managing a project and have two developers working for me and I am starting to track the project today. My project is located publicly on www.somedomain.com
.
Then to create a centralized repository I would:
//ssh + cd into the directory I want to track, then do
git init --bare myrootdirectory.git
Then the developers working on the project would clone this repository onto their local machine and use it as they wish, making changes and developing projects on their local machine. This is where I am a bit confused.
How would the developers commit their code onto the central repository, if we used --bare
, wouldn't it prevent them from doing that?
What happens after a project component has been tested by the developer and I would like to track it on the centralized repository that we used --bare
on?
Also, are the changes developers make on their local machine that they commit, only available on their local machine, or on the centralized repository as well? I read that there is some link between the centralized repository and the local one on the developers machine, which is why I am asking.
I appreciate clarification, thanks in advance!
Upvotes: 0
Views: 50
Reputation: 175098
The answer is two git repositories, (one bare, and one not), linked together by hooks. You can read more about it in this article, but I'll explain shortly:
The server holds two repos, a "public" one, and a "work" one (which is bare), you push to and pull from "work", and "work" has a git hook that goes to "public" and automatically pulls the changes when it gets pushed into.
Don't push into a non-bare repository, it causes problems.
Upvotes: 2