{"thread":{"id":"18125","subject":"Why isn't hook file cloned to bared repository ?","startedAt":"2009-03-04T05:40:56Z","lastAt":"2009-03-04T10:04:34Z","messageCount":3,"participants":["Emily Ren","Bryan Donlan","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106943","messageId":"856bfe0e0903032140w4d8a9415l9f7b9a0678b492cc@mail.gmail.com","threadId":"18125","inReplyTo":null,"subject":"Why isn't hook file cloned to bared repository ?","fromName":"Emily Ren","fromEmail":"lingyan.ren@gmail.com","sentAt":"2009-03-04T05:40:56Z","receivedAt":"2009-03-04T05:40:56Z","isPatch":false,"sender":{"key":"lingyan.ren@gmail.com","avatar":null},"body":"Hi,\n\nI added file \"update\" in my git repository my_repo/.git/hooks/,  then\nI run command \"git clone --bare my_repo\" to generate a bared\nrepository my_repo.git. But there's no update in my_repo.git/hooks.\n\nDo you know why ?\n\nThanks,\nEmily\n"},{"id":"106945","messageId":"3e8340490903032213u56734301o39c9d00633410fd5@mail.gmail.com","threadId":"18125","inReplyTo":"856bfe0e0903032140w4d8a9415l9f7b9a0678b492cc@mail.gmail.com","subject":"Re: Why isn't hook file cloned to bared repository ?","fromName":"Bryan Donlan","fromEmail":"bdonlan@gmail.com","sentAt":"2009-03-04T06:13:01Z","receivedAt":"2009-03-04T06:13:01Z","isPatch":false,"sender":{"key":"bdonlan@gmail.com","avatar":null},"body":"On Wed, Mar 4, 2009 at 12:40 AM, Emily Ren <lingyan.ren@gmail.com> wrote:\n> Hi,\n>\n> I added file \"update\" in my git repository my_repo/.git/hooks/,  then\n> I run command \"git clone --bare my_repo\" to generate a bared\n> repository my_repo.git. But there's no update in my_repo.git/hooks.\n>\n> Do you know why ?\n\nBecause allowing code from an untrusted third-party repository to be\nexecuted automatically without giving a chance to examine it is not a\nvery good idea from a security standpoint. In addition, hooks are\noften not of interest to the person cloning the repository. Because of\nthese reasons, git clone will not copy hooks from the source\nrepository (for consistency, this is the case even when the source is\nlocal).\n"},{"id":"106959","messageId":"alpine.DEB.1.00.0903041103270.8549@intel-tinevez-2-302","threadId":"18125","inReplyTo":"3e8340490903032213u56734301o39c9d00633410fd5@mail.gmail.com","subject":"Re: Why isn't hook file cloned to bared repository ?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-04T10:04:34Z","receivedAt":"2009-03-04T10:04:34Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 4 Mar 2009, Bryan Donlan wrote:\n\n> On Wed, Mar 4, 2009 at 12:40 AM, Emily Ren <lingyan.ren@gmail.com> wrote:\n>\n> > I added file \"update\" in my git repository my_repo/.git/hooks/,  then\n> > I run command \"git clone --bare my_repo\" to generate a bared\n> > repository my_repo.git. But there's no update in my_repo.git/hooks.\n> >\n> > Do you know why ?\n> \n> Because allowing code from an untrusted third-party repository to be\n> executed automatically without giving a chance to examine it is not a\n> very good idea from a security standpoint. In addition, hooks are\n> often not of interest to the person cloning the repository. Because of\n> these reasons, git clone will not copy hooks from the source\n> repository (for consistency, this is the case even when the source is\n> local).\n\nI might add that hooks are not part of the repository.  They are not \nversioned, for example.\n\nHaving said that, nothing prevents you from committing a set of example \nhooks and a script to install them, and tell your users that they may \ninstall default hooks using that script.  I do that for one of my \nprojects.\n\nCiao,\nDscho\n"}]}