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

Re: [PATCH] Add support for host aliases in config files

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Jan 25, 2008, 19:09 UTC
Message-ID
<alpine.LNX.1.00.0801251355490.13593@iabervon.org>
In-Reply-To
<m3fxwlagbu.fsf@localhost.localdomain>
On Fri, 25 Jan 2008, Jakub Narebski wrote:
Show 25 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > This allows users with different preferences for access methods to the
> > same remote repositories to rewrite each other's URLs to get the
> > desired access.
> 
> [...]
> > +host.<name>.base::
> > +	The base URL which should be used for this particular
> > +	host. This can be used by a user who has a better access
> > +	method to a repository than other users to make use of the
> > +	preferable path despite getting URLs from other users using
> > +	more commonly-available methods. Alternatively, a user who
> > +	only has less privileged access to a repository than the usual
> > +	audience can use this mechanism to replace disallowed methods
> > +	with public ones.
> > +
> > +host.<name>.alias::
> > +	Additional base URLs which refer to this host. If a URL
> > +	matches this, any access to it will use the URL formed with
> > +	the corresponding base URL instead of the given URL.
> > +
> 
> From this I could not get how those configuration are meant to be
> used. Perhaps some usage example?
[host "kernel"]
        base = git://git.kernel.org/pub/
        alias = git+ssh://master.kernel.org/pub/
	alias = master.kernel.org:/pub/
> BTW. wouldn't the same be solved better by enabling remote.<name>.url
> to be multi-valued, first working for fetch, all URLs for push?

The real point is actually for when you're dealing with URLs on the command line which you've cut-and-paste from email or other things. For example, the patches in the -mm quilt series say where the git trees are, but they're all like "git+ssh://master.kernel.org/pub/scm/linux/kernel/git/dtor/input.git", which is ideal for people (like Andrew) who have accounts on master, but requires manual fixing for people (like me) who don't.

With the above config, I can do:
git fetch git+ssh://master.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
and it actually fetches

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git, which actually works for me.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Jakub Narebski
Message 4 of 10 in “Add support for host aliases in config files”
  1. Add support for host aliases in config filesDaniel Barkalow, Jan 25, 2008
  2. Jakub NarebskiJan 25, 2008
  3. Junio C HamanoJan 25, 2008
  4. Daniel BarkalowJan 25, 2008
  5. Jakub NarebskiJan 25, 2008
  6. Daniel BarkalowJan 25, 2008
  7. Jakub NarebskiJan 25, 2008
  8. Junio C HamanoJan 25, 2008
  9. Daniel BarkalowJan 25, 2008
  10. Jakub NarebskiJan 25, 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.