git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git push in a git-init without --bare option?

From
CKChristof Krüger <mail@christof-krueger.de>
Date
Jun 26, 2011, 22:30 UTC
Message-ID
<1309127417.11860.142.camel@oxylap>
In-Reply-To
<201106262221.33294.psdc1978@gmail.com>
On So, 2011-06-26 at 22:21 +0100, Pedro Sa Costa wrote:
> So this means that eveytime that I want a repository to be shared by
> several 
> persons, the repository must always be bare?
Short answer: no.
Long answer: Not necessarily, it depends on your workflow.

You could have a central "official" repository on a server that is accessible by all members of your team. This is how centralized version-control systems like Subversion work. You can imitate this with git, but with git it's just convention, not a technical necessity. This central repository would then be bare, as nobody will work on it directly. If connectivity between developers is an issue (e.g. because of firewalls or NAT), this might be the preferred model in some cases. You can also use a service like github.com for example.

But you could also use it the distributed way. Then you should understand and respect the asymmetry between push and pull. Every developer on a team can have a local (non-bare) repository he works on. As it is his private repository, all you can say is "hey buddy, I've got a shiny new feature ready. Pull branch 'foobar' from my private repository". He can then decide to pull and merge it with his code if he wishes.

The above doesn't work if you'd allowed everyone to push around stuff to other developers without their consent. You would lose control over your own private repository and your working-copy would never be up-to-date with what is the HEAD of your repo.

Of course, you can have a topology that is far more complex than what I outlined above, combining bare and non-bare repositories at once and having multiple repositories per developer, but I hope that the basic idea became clear.

Regards,
  Chris
Previous: Pedro Sa Costa
Message 5 of 5 in “git push in a git-init without --bare option?”
  1. Pedro Sa CostaJun 26, 2011
  2. Elia PintoJun 26, 2011
  3. Matthieu MoyJun 26, 2011
  4. Pedro Sa CostaJun 26, 2011
  5. Christof KrügerJun 26, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.