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

Re: Init on push

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 8, 2008, 19:26 UTC
Message-ID
<7viqqyc93w.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200811081708.45672.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:
Show 6 quoted lines
> git remote add someremote someurl
> git push --init someremote/someurl
>
> The implementation would invoke receive pack on the receiving side with
> an --init option. On the server side the repository would be created and
> initialized just as one had executed and mkdir and git init --bare.

We saw this quite a number of times. I think it's about time we did something about it.

But I do not think it is a reasonable design to give receive-pack such an option.

An easy alternative would be to issue the usual "mkdir && git init" shell script before spawning receive-pack. This will limit the feature to pushing over the ssh transport, and pushing over the git protocol against a loose git-daemon will not be able to support it. Also I suspect this will break sites managed by gitosis, where all repositories are held under the same UNIX user identity, differenciated only via an environment it sets based on the ssh key used to make the connection.

I wonder if you can take a middle ground alternative:
 - Make "git push --init [--shared] $site:$there" and "git push --init
   [--shared] git://$site/$there" run "git init -D [--shared] $there"
   followed by "git receive-pack $there";
 - Teach "-D $there" option to "git init", which does an "mkdir -p $it &&
   chdird $it" before it does its work.
 
 - Teach "git daemon" about the "init" service, which is disabled by
   default, and can be enabled just like you can enable receive-pack
   there.

If sites like repo.or.cz, github, or managed with gitosis want to use this, I think you might further need to give "git init -D $there" a hook to control who can create new repositories at which location (gitosis is the most interesting case, as described above).

Previous: Robin RosenbergNext: Alexander Gavrilov
Message 2 of 11 in “Init on push”
  1. Robin RosenbergNov 8, 2008
  2. Junio C HamanoNov 8, 2008
  3. Alexander GavrilovNov 8, 2008
  4. Junio C HamanoNov 8, 2008
  5. Jakub NarebskiNov 8, 2008
  6. Francis GaliegueNov 8, 2008
  7. Junio C HamanoNov 8, 2008
  8. Francis GaliegueNov 8, 2008
  9. Francis GaliegueNov 8, 2008
  10. Junio C HamanoNov 9, 2008
  11. Francis GaliegueNov 9, 2008

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.