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

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

From
PCPedro Sa Costa <psdc1978@gmail.com>
Date
Jun 26, 2011, 21:21 UTC
Message-ID
<201106262221.33294.psdc1978@gmail.com>
In-Reply-To
<vpqliwoa24m.fsf@bauges.imag.fr>

So this means that eveytime that I want a repository to be shared by several persons, the repository must always be bare?

Show 20 quoted lines
> Pedro Sa Costa <psdc1978@gmail.com> writes:
> > - I see that in git, I can't do git-push to a repository that wasn't
> > created with git-init --bare. Why?
> > 
> > - But doing git-pull and git-checkout to the same repository is possible.
> > I'm really confused. Any help?
> 
> git pull involves a merge, and merge may involve conflicts, and
> conflicts involve a user fixing them ... So, doing a "git pull" to merge
> in remote changes is OK, but a "git push" cannot merge changes remotely,
> hence the asymetry.
> 
> Git could just send the commits, without updating the working tree, but
> that would be terrible for the user. Let's say the user has no local
> change before the push. His checkout points to the tip of a branch
> (information stored in HEAD), so the tree matches the old HEAD. Updating
> the branch means changing the commit pointed to by HEAD, hence after a
> push, the tree does not match the HEAD anymore (which means the next
> commit will seem to revert the pushed history). This is to prevent this
> situation that Git refuses to push to non-bare repos.
-- 
Best regards,

-----------------------
Previous: Matthieu MoyNext: Christof Krüger
Message 4 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.