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

Re: Subject: [PATCH] Push to create

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 3, 2009, 07:37 UTC
Message-ID
<76718490903022337n79a0c11cw95e80d99cd598d17@mail.gmail.com>
In-Reply-To
<20090303070937.GB30609@coredump.intra.peff.net>
On Tue, Mar 3, 2009 at 2:09 AM, Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
> If you are going to limit it in that way, wouldn't it be better to do it
> entirely client-side? As in, "git push --create remote" will literally
> do:
>
>    ssh remote_host "mkdir -p remote_dir && cd remote_dir && git init --bare"
>
> ? Then you don't have to care about whether the remote side is recent
> enough to support this, and there are no potential security issues; git
> is merely saving you from typing the commands you could have done
> yourself.

So I was curious how Mercurial implemented this, and it is similar to what Junio coded. It runs "hg init" on the remote end via ssh. (hg init <path> takes care of creating the directory; I just also noticed you can do hg init ssh://host/path to create the repo remotely, which is I guess sorta interesting.)

Show 5 quoted lines
> I think a featur like this needs to be triggered manually via
> "--create" or similar. Otherwise a typo on a regular push will be very
> confusing as your pushes appear to go nowhere. Though I suppose most
> regular pushes happen using a configured remote, in which case it is not
> as much of an issue.

So I could've sworn Mercurial creates a remote repo for you on push, but it turns out it does not:

$ hg push ssh://localhost/~/bar remote: abort: There is no Mercurial repository here (.hg not found)! abort: no suitable response from remote hg!

I concur w/Jeff and I think git probably should not as well. I think that instead adding it to init might be interesting

"git init <arg>" where <arg> is local (and it creates the directory and repo for you) or arg is ssh://... and it creates the dir and repo over there for you.

And have "git push" abort with a friendlier message than:

fatal: '~/bar': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly

If that's a plumbing message maybe it can't change, unless push swallows it and says something nicer like:

fatal: '~/bar' not a git repository. Create the destination repository with "git init" before pushing.

We can be even friendlier than Mercurial. :-)
j.
Previous: Jeff KingNext: Jay Soffian
Message 12 of 43 in “Refactor list of environment variables to be sanitized”
  1. 1/4 Refactor list of environment variables to be sanitizedJunio C Hamano, Mar 1, 2009
  2. 2/4 git-init: inject some sanity to the option parserJunio C Hamano, Mar 1, 2009
  3. 3/4 Add init-serve, the remote side of "git init --remote=host:path"Junio C Hamano, Mar 1, 2009
  4. 4/4 "git init --remote=host:path"Junio C Hamano, Mar 1, 2009
  5. Jeff KingMar 1, 2009
  6. Junio C HamanoMar 1, 2009
  7. Jeff KingMar 1, 2009
  8. Shawn O. PearceMar 1, 2009
  9. Subject: [PATCH] Push to createJunio C Hamano, Mar 3, 2009
  10. Jay SoffianMar 3, 2009
  11. Jeff KingMar 3, 2009
  12. Jay SoffianMar 3, 2009
  13. Jay SoffianMar 3, 2009
  14. Junio C HamanoMar 3, 2009
  15. Jay SoffianMar 3, 2009
  16. Junio C HamanoMar 3, 2009
  17. Junio C HamanoMar 3, 2009
  18. Jay SoffianMar 3, 2009
  19. Jeff KingMar 3, 2009
  20. Jay SoffianMar 3, 2009
  21. Jeff KingMar 4, 2009
  22. Junio C HamanoMar 4, 2009
  23. Jay SoffianMar 4, 2009
  24. Junio C HamanoMar 3, 2009
  25. Jeff KingMar 3, 2009
  26. Junio C HamanoMar 3, 2009
  27. Jeff KingMar 3, 2009
  28. Junio C HamanoMar 3, 2009
  29. Jay SoffianMar 3, 2009
  30. Theodore TsoMar 3, 2009
  31. Johannes SchindelinMar 3, 2009
  32. Theodore TsoMar 4, 2009
  33. Miles BaderMar 6, 2009
  34. Shawn O. PearceMar 3, 2009
  35. 1/2 improve missing repository error messageJeff King, Mar 4, 2009
  36. Matthieu MoyMar 4, 2009
  37. Jeff KingMar 4, 2009
  38. Shawn O. PearceMar 4, 2009
  39. Jeff KingMar 5, 2009
  40. 2/2 make remote hangup warnings more friendlyJeff King, Mar 4, 2009
  41. Shawn O. PearceMar 4, 2009
  42. Jeff KingMar 5, 2009
  43. Daniel BarkalowMar 3, 2009

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.