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

Re: Adding default remotes to a bare repository

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Feb 11, 2011, 17:11 UTC
Message-ID
<4D556DCD.3050907@gmail.com>
In-Reply-To
<m21v3eojr6.fsf@gmail.com>
On 2/11/2011 6:09 AM, Francis Moreau wrote:
Show 27 quoted lines
> Neal Kreitzinger<nkreitzinger@gmail.com>  writes:
>
> [...]
>
>> you can do some hook setup automation using git templates.  see the
>> --template option of git-clone manpage and 'template directory'
>> section of git-init manpage.  There is some big reason why they don't
>> let you inherit hooks from the origin repo of the clone repo.  I think
>> its basically because you could have security risks or compromise git
>> integrity/workflow with hook inheritance.  If you look in the
>> newsgroup people have talked about this alot before.
> Ok I'll look at what have been said.
>
>> As far as your request for automatic remotes, a flaw in your logic may
>> be that you think the functionality you want would let you clone from
>> an already-setup clone (1) which points to remote (a) then the new
>> clone (2) would point to the remote (a) of clone(1).  Not so.  When
>> you make a clone it does get an automatic remote to the repo it was
>> cloned from.  This is called 'origin' remote.  Therefore, clone(2) has
>> an origin remote to clone (1).  Your idea on automatic remote setup is
>> in direct conflict with the way git currently does automatic origin
>> remote setup.  You can't do both because that would turn in to a real
>> mess pretty quickly.
> I don't understand your last sentence. Why do you think it's going to be
> messy ?
>
> Thanks

you're wanting the remote 'origin' of the clone(2) to be the same as the remote 'origin' of clone(1), ie. remote(a). However, the git behaviour is that if you clone clone(2) from clone(1) then the the remote 'origin' of clone(2) will be clone(1). The repo you cloned from is by default the remote 'origin' of the new clone.

However, you can create a config file in your --template dir that has the definitions of these "universal" remotes you are wanting everyone to have. Then specify that template in your clone command (with --template) and it should pickup that config. I say "should" because I haven't tried this exact scenario. I think config acts a little different via a template dir than hooks. Try it and see if it works.

v/r, neal

Previous: Francis Moreau
Message 6 of 6 in “Adding default remotes to a bare repository”
  1. Francis MoreauFeb 9, 2011
  2. Neal KreitzingerFeb 10, 2011
  3. Francis MoreauFeb 10, 2011
  4. Neal KreitzingerFeb 10, 2011
  5. Francis MoreauFeb 11, 2011
  6. Neal KreitzingerFeb 11, 2011

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.