0

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!

1 Answer 1

2

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.

Some more reading:

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. So, do changes developers make on their local machine only available locally or also available on the work directory on the server via the hook?
@AnchovyLegend: Read the "Working with Remotes" article. Basically, you link to the server-side repo with the git remote command, and then you can git push to it, and git pull from it. You can't push until you've pulled the latest changes, and that's how everyone have an up-to-date copy of everything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.