git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding default remotes to a bare repository
@ 2011-02-09 16:53 Francis Moreau
  2011-02-10 19:08 ` Neal Kreitzinger
  0 siblings, 1 reply; 6+ messages in thread
From: Francis Moreau @ 2011-02-09 16:53 UTC (permalink / raw)
  To: git

Hi,

Is it possible to add some default remotes for a given repository ?

That is when cloning the repository, I can use the default remotes in
the cloned repository.

Thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Adding default remotes to a bare repository
  2011-02-09 16:53 Adding default remotes to a bare repository Francis Moreau
@ 2011-02-10 19:08 ` Neal Kreitzinger
  2011-02-10 21:24   ` Francis Moreau
  0 siblings, 1 reply; 6+ messages in thread
From: Neal Kreitzinger @ 2011-02-10 19:08 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

On 2/9/2011 10:53 AM, Francis Moreau wrote:
> Hi,
>
> Is it possible to add some default remotes for a given repository ?
>
> That is when cloning the repository, I can use the default remotes in
> the cloned repository.
>
> Thanks
You could write a script that does the clone and then adds the remotes. 
  We have a "menu" written in bash scripts and it does the clones and 
adds the default remotes automatically.  So instead of just doing "git 
clone", people would run that script to do the clone and add the remotes.

v/r,
Neal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Adding default remotes to a bare repository
  2011-02-10 19:08 ` Neal Kreitzinger
@ 2011-02-10 21:24   ` Francis Moreau
  2011-02-10 22:03     ` Neal Kreitzinger
  0 siblings, 1 reply; 6+ messages in thread
From: Francis Moreau @ 2011-02-10 21:24 UTC (permalink / raw)
  To: Neal Kreitzinger; +Cc: git

On Thu, Feb 10, 2011 at 8:08 PM, Neal Kreitzinger
<nkreitzinger@gmail.com> wrote:
>
> You could write a script that does the clone and then adds the remotes.  We
> have a "menu" written in bash scripts and it does the clones and adds the
> default remotes automatically.  So instead of just doing "git clone", people
> would run that script to do the clone and add the remotes.
>

Sure.

But I'm wondering why cloning operation can't import the remote
branches of the cloned repository.

Actually I'm wondering the same thing for hooks. If a repository setup
some hooks, can't these hooks be installed by default in the new
repositories ?

-- 
Francis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Adding default remotes to a bare repository
  2011-02-10 21:24   ` Francis Moreau
@ 2011-02-10 22:03     ` Neal Kreitzinger
  2011-02-11 12:09       ` Francis Moreau
  0 siblings, 1 reply; 6+ messages in thread
From: Neal Kreitzinger @ 2011-02-10 22:03 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

On 2/10/2011 3:24 PM, Francis Moreau wrote:
> On Thu, Feb 10, 2011 at 8:08 PM, Neal Kreitzinger
> <nkreitzinger@gmail.com>  wrote:
>> You could write a script that does the clone and then adds the remotes.  We
>> have a "menu" written in bash scripts and it does the clones and adds the
>> default remotes automatically.  So instead of just doing "git clone", people
>> would run that script to do the clone and add the remotes.
>>
> Sure.
>
> But I'm wondering why cloning operation can't import the remote
> branches of the cloned repository.
>
> Actually I'm wondering the same thing for hooks. If a repository setup
> some hooks, can't these hooks be installed by default in the new
> repositories ?
>
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.

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.  Perhaps what you want is just "cp -r", ie. "cp -r clone-1 
clone-2".  then the clone-2 repo will have all the remotes and hooks of 
clone-1 and point to the same origin remote (a), but will live in a 
directory/working-tree called "clone-2".  "cp -r" will give you an exact 
duplicate thats totally functional, but occupying a different namespace.

hope this helps.

v/r,
neal

v/r,
neal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Adding default remotes to a bare repository
  2011-02-10 22:03     ` Neal Kreitzinger
@ 2011-02-11 12:09       ` Francis Moreau
  2011-02-11 17:11         ` Neal Kreitzinger
  0 siblings, 1 reply; 6+ messages in thread
From: Francis Moreau @ 2011-02-11 12:09 UTC (permalink / raw)
  To: Neal Kreitzinger; +Cc: git

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
-- 
Francis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Adding default remotes to a bare repository
  2011-02-11 12:09       ` Francis Moreau
@ 2011-02-11 17:11         ` Neal Kreitzinger
  0 siblings, 0 replies; 6+ messages in thread
From: Neal Kreitzinger @ 2011-02-11 17:11 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

On 2/11/2011 6:09 AM, Francis Moreau wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-11 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 16:53 Adding default remotes to a bare repository Francis Moreau
2011-02-10 19:08 ` Neal Kreitzinger
2011-02-10 21:24   ` Francis Moreau
2011-02-10 22:03     ` Neal Kreitzinger
2011-02-11 12:09       ` Francis Moreau
2011-02-11 17:11         ` Neal Kreitzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).