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

[PATCHv2 0/2] Add url.<base>.pushInsteadOf: URL rewriting for push only

From
Josh Triplett <josh@joshtriplett.org>
Date
Sep 7, 2009, 08:55 UTC
Message-ID
<cover.1252313313.git.josh@joshtriplett.org>

Many sites host repositories via both git:// for fetch-only anonymous access and ssh:// for push-capable access. The "insteadOf" mechanism makes it straightforward to substitute the push-capable URLs for the pull-only URLs, which proves convenient when the site hosts many repositories using the same URL scheme. However, if you use such a substitution and you cannot use the ssh:// URLs (either because you don't have SSH access or you don't have permission to a particular repository), you cannot clone or fetch either, even though you could do so via the git:// URLs. A situation like this arises when sharing git configuration files between systems, of which only a few have SSH access to repositories.

"pushurl" provides a way to specify URLs used only for push, but this requires configuring a pushurl for each such repository. As in the rationale for insteadOf, it makes sense to configure this for all repositories hosted on a given system at once.

This patch series adds a new "pushInsteadOf" option to go with "insteadOf". pushInsteadOf allows systematically rewriting fetch-only URLs to push-capable URLs when used with push. For instance:

[url "ssh://example.org/"]
    pushInsteadOf = "git://example.org/"

This will allow clones of "git://example.org/path/to/repo" to subsequently push to "ssh://example.org/path/to/repo", without manually configuring pushurl for that remote.

Includes documentation for the new option, bash completion updates, and test cases (both that pushInsteadOf applies to push and that it does *not* apply to fetch).

Changes in v2:
 - Don't add implicit pushurls from pushInsteadOf to remotes with explicit
   pushurls (suggested by Junio).
 - Fix pushInsteadOf rewrites to occur before insteadOf rewrites, to avoid
   basing the pushInsteadOf rewrites on the rewritten URLs.
Josh Triplett (2):
  Wrap rewrite globals in a struct in preparation for adding another set
  Add url.<base>.pushInsteadOf: URL rewriting for push only
 Documentation/config.txt               |   13 +++++
 Documentation/urls.txt                 |   18 +++++++
 contrib/completion/git-completion.bash |    2 +-
 remote.c                               |   83 ++++++++++++++++++++------------
 t/t5516-fetch-push.sh                  |   31 ++++++++++++
 5 files changed, 115 insertions(+), 32 deletions(-)
Next: Josh Triplett
Message 1 of 7 in “[PATCHv2 0/2] Add url.<base>.pushInsteadOf: URL rewriting for push only”
  1. Josh TriplettSep 7, 2009
  2. 1/2 Wrap rewrite globals in a struct in preparation for adding another setJosh Triplett, Sep 7, 2009
  3. 2/2 Add url.<base>.pushInsteadOf: URL rewriting for push onlyJosh Triplett, Sep 7, 2009
  4. Junio C HamanoSep 8, 2009
  5. Josh TriplettSep 8, 2009
  6. Add test for ignoring pushInsteadOf when remote has explicit pushurlJosh Triplett, Sep 8, 2009
  7. Junio C HamanoSep 8, 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.