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

Re: Specifying multiple refspecs in remote.{remote}.fetch

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 20, 2009, 07:42 UTC
Message-ID
<m3eitfgxln.fsf@localhost.localdomain>
In-Reply-To
<2cfc40320906192337g66db81f0w92e06adfc6a189c9@mail.gmail.com>
Jon Seymour <jon.seymour@gmail.com> writes:
Show 18 quoted lines
> It doesn't seem to be possible to specify multiple refspecs in a git config.
> 
> I want to do this:
> 
> remote.hub/pub/release.fetch=+refs/heads/*:refs/remotes/hub/pub/release/*
> +refs/tags/*:refs/tags/hub/pub/release/*
> remote.hub/pub/release.tagopt=--no-tags
> 
> but git fetch complains:
> 
> fatal: Invalid refspec '+refs/heads/*:refs/remotes/hub/pub/release/*
> +refs/tags/*:refs/tags/hub/pub/release/*'
> 
> Now, in theory, I could use a file in remotes/ to specify multiple
> Pull: lines. This works if my remote doesn't have slashes in its name,
> but it doesn't work if my remote does have slashes in its name since
> git doesn't recognize remote files located in sub-directories of
> ${GIT_DIR}/remotes.

And you can put multiple values for the same remote.hub/pub/release.fetch key, using "git config --add".

  $ git config --add remote.hub/pub/release.fetch \
        +refs/heads/*:refs/remotes/hub/pub/release/*
  $ git config --add remote.hub/pub/release.fetch \
        +refs/tags/*:refs/tags/hub/pub/release/*
  $ ...
You would get the following config:
  [remote "hub/pub/release"]
        url = ...
        fetch = +refs/heads/*:refs/remotes/hub/pub/release/*
        fetch = +refs/tags/*:refs/tags/hub/pub/release/*
        tagopts = --no-tags
You don't put many refspecs in a *single* value.
 
> Is it a reasonable expectation that:
> 
> * git should support multiple refspecs specified via git config?
It does.
> * git should support subdirectories in ${GIT_DIR}/remotes?
It does.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Jon SeymourNext: Jon Seymour
Message 2 of 3 in “Specifying multiple refspecs in remote.{remote}.fetch”
  1. Jon SeymourJun 20, 2009
  2. Jakub NarebskiJun 20, 2009
  3. Jon SeymourJun 20, 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.