{"thread":{"id":"26456","subject":"Adding default remotes to a bare repository","startedAt":"2011-02-09T16:53:07Z","lastAt":"2011-02-11T17:11:41Z","messageCount":6,"participants":["Francis Moreau","Neal Kreitzinger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"160774","messageId":"AANLkTikVtSFs+qRiWJwxre8urOJs7q2HXBGPZkiTmn=i@mail.gmail.com","threadId":"26456","inReplyTo":null,"subject":"Adding default remotes to a bare repository","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-02-09T16:53:07Z","receivedAt":"2011-02-09T16:53:07Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Hi,\n\nIs it possible to add some default remotes for a given repository ?\n\nThat is when cloning the repository, I can use the default remotes in\nthe cloned repository.\n\nThanks\n-- \nFrancis\n"},{"id":"160833","messageId":"4D5437C4.6000401@gmail.com","threadId":"26456","inReplyTo":"AANLkTikVtSFs+qRiWJwxre8urOJs7q2HXBGPZkiTmn=i@mail.gmail.com","subject":"Re: Adding default remotes to a bare repository","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-02-10T19:08:52Z","receivedAt":"2011-02-10T19:08:52Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 2/9/2011 10:53 AM, Francis Moreau wrote:\n> Hi,\n>\n> Is it possible to add some default remotes for a given repository ?\n>\n> That is when cloning the repository, I can use the default remotes in\n> the cloned repository.\n>\n> Thanks\nYou could write a script that does the clone and then adds the remotes. \n  We have a \"menu\" written in bash scripts and it does the clones and \nadds the default remotes automatically.  So instead of just doing \"git \nclone\", people would run that script to do the clone and add the remotes.\n\nv/r,\nNeal\n"},{"id":"160839","messageId":"AANLkTimg0YZ7eQ=hsxqSYJPipahLpiqZqSVkFz25=A2k@mail.gmail.com","threadId":"26456","inReplyTo":"4D5437C4.6000401@gmail.com","subject":"Re: Adding default remotes to a bare repository","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-02-10T21:24:20Z","receivedAt":"2011-02-10T21:24:20Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Thu, Feb 10, 2011 at 8:08 PM, Neal Kreitzinger\n<nkreitzinger@gmail.com> wrote:\n>\n> You could write a script that does the clone and then adds the remotes.  We\n> have a \"menu\" written in bash scripts and it does the clones and adds the\n> default remotes automatically.  So instead of just doing \"git clone\", people\n> would run that script to do the clone and add the remotes.\n>\n\nSure.\n\nBut I'm wondering why cloning operation can't import the remote\nbranches of the cloned repository.\n\nActually I'm wondering the same thing for hooks. If a repository setup\nsome hooks, can't these hooks be installed by default in the new\nrepositories ?\n\n-- \nFrancis\n"},{"id":"160842","messageId":"4D5460B9.9070300@gmail.com","threadId":"26456","inReplyTo":"AANLkTimg0YZ7eQ=hsxqSYJPipahLpiqZqSVkFz25=A2k@mail.gmail.com","subject":"Re: Adding default remotes to a bare repository","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-02-10T22:03:37Z","receivedAt":"2011-02-10T22:03:37Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 2/10/2011 3:24 PM, Francis Moreau wrote:\n> On Thu, Feb 10, 2011 at 8:08 PM, Neal Kreitzinger\n> <nkreitzinger@gmail.com>  wrote:\n>> You could write a script that does the clone and then adds the remotes.  We\n>> have a \"menu\" written in bash scripts and it does the clones and adds the\n>> default remotes automatically.  So instead of just doing \"git clone\", people\n>> would run that script to do the clone and add the remotes.\n>>\n> Sure.\n>\n> But I'm wondering why cloning operation can't import the remote\n> branches of the cloned repository.\n>\n> Actually I'm wondering the same thing for hooks. If a repository setup\n> some hooks, can't these hooks be installed by default in the new\n> repositories ?\n>\nyou can do some hook setup automation using git templates.  see the \n--template option of git-clone manpage and 'template directory' section \nof git-init manpage.  There is some big reason why they don't let you \ninherit hooks from the origin repo of the clone repo.  I think its \nbasically because you could have security risks or compromise git \nintegrity/workflow with hook inheritance.  If you look in the newsgroup \npeople have talked about this alot before.\n\nAs far as your request for automatic remotes, a flaw in your logic may \nbe that you think the functionality you want would let you clone from an \nalready-setup clone (1) which points to remote (a) then the new clone \n(2) would point to the remote (a) of clone(1).  Not so.  When you make a \nclone it does get an automatic remote to the repo it was cloned from.  \nThis is called 'origin' remote.  Therefore, clone(2) has an origin \nremote to clone (1).  Your idea on automatic remote setup is in direct \nconflict with the way git currently does automatic origin remote setup.  \nYou can't do both because that would turn in to a real mess pretty \nquickly.  Perhaps what you want is just \"cp -r\", ie. \"cp -r clone-1 \nclone-2\".  then the clone-2 repo will have all the remotes and hooks of \nclone-1 and point to the same origin remote (a), but will live in a \ndirectory/working-tree called \"clone-2\".  \"cp -r\" will give you an exact \nduplicate thats totally functional, but occupying a different namespace.\n\nhope this helps.\n\nv/r,\nneal\n\nv/r,\nneal\n"},{"id":"160892","messageId":"m21v3eojr6.fsf@gmail.com","threadId":"26456","inReplyTo":"4D5460B9.9070300@gmail.com","subject":"Re: Adding default remotes to a bare repository","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-02-11T12:09:33Z","receivedAt":"2011-02-11T12:09:33Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Neal Kreitzinger <nkreitzinger@gmail.com> writes:\n\n[...]\n\n> you can do some hook setup automation using git templates.  see the\n> --template option of git-clone manpage and 'template directory'\n> section of git-init manpage.  There is some big reason why they don't\n> let you inherit hooks from the origin repo of the clone repo.  I think\n> its basically because you could have security risks or compromise git\n> integrity/workflow with hook inheritance.  If you look in the\n> newsgroup people have talked about this alot before.\n\nOk I'll look at what have been said.\n\n> As far as your request for automatic remotes, a flaw in your logic may\n> be that you think the functionality you want would let you clone from\n> an already-setup clone (1) which points to remote (a) then the new\n> clone (2) would point to the remote (a) of clone(1).  Not so.  When\n> you make a clone it does get an automatic remote to the repo it was\n> cloned from.  This is called 'origin' remote.  Therefore, clone(2) has\n> an origin remote to clone (1).  Your idea on automatic remote setup is\n> in direct conflict with the way git currently does automatic origin\n> remote setup.  You can't do both because that would turn in to a real\n> mess pretty quickly.\n\nI don't understand your last sentence. Why do you think it's going to be\nmessy ?\n\nThanks\n-- \nFrancis\n"},{"id":"160902","messageId":"4D556DCD.3050907@gmail.com","threadId":"26456","inReplyTo":"m21v3eojr6.fsf@gmail.com","subject":"Re: Adding default remotes to a bare repository","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-02-11T17:11:41Z","receivedAt":"2011-02-11T17:11:41Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 2/11/2011 6:09 AM, Francis Moreau wrote:\n> Neal Kreitzinger<nkreitzinger@gmail.com>  writes:\n>\n> [...]\n>\n>> you can do some hook setup automation using git templates.  see the\n>> --template option of git-clone manpage and 'template directory'\n>> section of git-init manpage.  There is some big reason why they don't\n>> let you inherit hooks from the origin repo of the clone repo.  I think\n>> its basically because you could have security risks or compromise git\n>> integrity/workflow with hook inheritance.  If you look in the\n>> newsgroup people have talked about this alot before.\n> Ok I'll look at what have been said.\n>\n>> As far as your request for automatic remotes, a flaw in your logic may\n>> be that you think the functionality you want would let you clone from\n>> an already-setup clone (1) which points to remote (a) then the new\n>> clone (2) would point to the remote (a) of clone(1).  Not so.  When\n>> you make a clone it does get an automatic remote to the repo it was\n>> cloned from.  This is called 'origin' remote.  Therefore, clone(2) has\n>> an origin remote to clone (1).  Your idea on automatic remote setup is\n>> in direct conflict with the way git currently does automatic origin\n>> remote setup.  You can't do both because that would turn in to a real\n>> mess pretty quickly.\n> I don't understand your last sentence. Why do you think it's going to be\n> messy ?\n>\n> Thanks\nyou're wanting the remote 'origin' of the clone(2) to be the same as the \nremote 'origin' of clone(1), ie. remote(a).  However, the git behaviour \nis that if you clone clone(2) from clone(1) then the the remote 'origin' \nof clone(2) will be clone(1).  The repo you cloned from is by default \nthe remote 'origin' of the new clone.\n\nHowever, you can create a config file in your --template dir that has \nthe definitions of these \"universal\" remotes you are wanting everyone to \nhave.  Then specify that template in your clone command (with \n--template) and it should pickup that config.  I say \"should\" because I \nhaven't tried this exact scenario.  I think config acts a little \ndifferent via a template dir than hooks.  Try it and see if it works.\n\nv/r,\nneal\n"}]}