{"thread":{"id":"27851","subject":"how to add files/folder from work-tree","startedAt":"2011-07-19T06:30:48Z","lastAt":"2011-07-20T10:52:08Z","messageCount":5,"participants":["J. Bakshi","Chris Packham"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171640","messageId":"20110719120048.3dd56eb6@shiva.selfip.org","threadId":"27851","inReplyTo":null,"subject":"how to add files/folder from work-tree","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-19T06:30:48Z","receivedAt":"2011-07-19T06:30:48Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"Hello,\n\nI am using a git repo which has detached work tree. I like to add the files, folders located at the work tree ( it is a site under htdocs) at the git repo. Is it possible to do it within the work-tree or I need a separate working space from where I need to do all these operation ?\n\nThanks\n \n"},{"id":"171643","messageId":"4E253C94.7000709@gmail.com","threadId":"27851","inReplyTo":"20110719133633.0797713d@shiva.selfip.org","subject":"Re: how to add files/folder from work-tree","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2011-07-19T08:13:08Z","receivedAt":"2011-07-19T08:13:08Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Oops managed to drop the Cc for the mailing list from my initial response.\n\nOn 19/07/11 20:06, J. Bakshi wrote:\n> On Tue, 19 Jul 2011 19:53:28 +1200\n> Chris Packham <judge.packham@gmail.com> wrote:\n> \n>> On 19/07/11 18:30, J. Bakshi wrote:\n>>> Hello,\n>>>\n>>> I am using a git repo which has detached work tree. I like to add the files, folders located at the work tree ( it is a site under htdocs) at the git repo. Is it possible to do it within the work-tree or I need a separate working space from where I need to do all these operation ?\n>>>\n>>> Thanks\n>>>  \n>>> --\n>>\n>> I'm not sure I fully understand your question but what I _think_ you\n>> want to do is specify the path to the repository with the GIT_DIR\n>> environment variable. Like this\n>>\n>>  cd /place/where/files/are\n>>  GIT_DIR=/place/were/repo/is/.git git add <file>\n>>\n> \n> \n> I have set a git repo with attached work-tree with hook as below\n> \n> git -bare init  /home/git/test.git\n> cd /home/git/test.git\n> git config core.worktree /var/www/test\n> \n> vim /home/git/test.git/hooks/post-receive\n> \n> #!/bin/sh\n> git checkout -f\n> \n> Now the /var/www/test has already some files/folder. How can I add those to the repo within from its work-tree ?\n> \n> Thanks\n\nI think my initial response is correct. Try the following\n\n  cd /var/www/test\n  git --git-dir=/home/git/test.git add <files>\n  git --git-dir=/home/git/test.git commit -m \"blah\"\n"},{"id":"171644","messageId":"20110719135224.52c4301d@shiva.selfip.org","threadId":"27851","inReplyTo":"4E253C94.7000709@gmail.com","subject":"Re: how to add files/folder from work-tree","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-19T08:22:24Z","receivedAt":"2011-07-19T08:22:24Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Tue, 19 Jul 2011 20:13:08 +1200\nChris Packham <judge.packham@gmail.com> wrote:\n\n> Oops managed to drop the Cc for the mailing list from my initial response.\n> \n> On 19/07/11 20:06, J. Bakshi wrote:\n> > On Tue, 19 Jul 2011 19:53:28 +1200\n> > Chris Packham <judge.packham@gmail.com> wrote:\n> > \n> >> On 19/07/11 18:30, J. Bakshi wrote:\n> >>> Hello,\n> >>>\n> >>> I am using a git repo which has detached work tree. I like to add the files, folders located at the work tree ( it is a site under htdocs) at the git repo. Is it possible to do it within the work-tree or I need a separate working space from where I need to do all these operation ?\n> >>>\n> >>> Thanks\n> >>>  \n> >>> --\n> >>\n> >> I'm not sure I fully understand your question but what I _think_ you\n> >> want to do is specify the path to the repository with the GIT_DIR\n> >> environment variable. Like this\n> >>\n> >>  cd /place/where/files/are\n> >>  GIT_DIR=/place/were/repo/is/.git git add <file>\n> >>\n> > \n> > \n> > I have set a git repo with attached work-tree with hook as below\n> > \n> > git -bare init  /home/git/test.git\n> > cd /home/git/test.git\n> > git config core.worktree /var/www/test\n> > \n> > vim /home/git/test.git/hooks/post-receive\n> > \n> > #!/bin/sh\n> > git checkout -f\n> > \n> > Now the /var/www/test has already some files/folder. How can I add those to the repo within from its work-tree ?\n> > \n> > Thanks\n> \n> I think my initial response is correct. Try the following\n> \n>   cd /var/www/test\n>   git --git-dir=/home/git/test.git add <files>\n>   git --git-dir=/home/git/test.git commit -m \"blah\"\n> \n> \n\nGreat !! Thanks \n"},{"id":"171730","messageId":"20110720154644.67974a7f@shiva.selfip.org","threadId":"27851","inReplyTo":"4E253C94.7000709@gmail.com","subject":"Re: how to add files/folder from work-tree","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-20T10:16:44Z","receivedAt":"2011-07-20T10:16:44Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Tue, 19 Jul 2011 20:13:08 +1200\nChris Packham <judge.packham@gmail.com> wrote:\n\n> Oops managed to drop the Cc for the mailing list from my initial response.\n> \n> On 19/07/11 20:06, J. Bakshi wrote:\n> > On Tue, 19 Jul 2011 19:53:28 +1200\n> > Chris Packham <judge.packham@gmail.com> wrote:\n> > \n> >> On 19/07/11 18:30, J. Bakshi wrote:\n> >>> Hello,\n> >>>\n> >>> I am using a git repo which has detached work tree. I like to add the files, folders located at the work tree ( it is a site under htdocs) at the git repo. Is it possible to do it within the work-tree or I need a separate working space from where I need to do all these operation ?\n> >>>\n> >>> Thanks\n> >>>  \n> >>> --\n> >>\n> >> I'm not sure I fully understand your question but what I _think_ you\n> >> want to do is specify the path to the repository with the GIT_DIR\n> >> environment variable. Like this\n> >>\n> >>  cd /place/where/files/are\n> >>  GIT_DIR=/place/were/repo/is/.git git add <file>\n> >>\n> > \n> > \n> > I have set a git repo with attached work-tree with hook as below\n> > \n> > git -bare init  /home/git/test.git\n> > cd /home/git/test.git\n> > git config core.worktree /var/www/test\n> > \n> > vim /home/git/test.git/hooks/post-receive\n> > \n> > #!/bin/sh\n> > git checkout -f\n> > \n> > Now the /var/www/test has already some files/folder. How can I add those to the repo within from its work-tree ?\n> > \n> > Thanks\n> \n> I think my initial response is correct. Try the following\n> \n>   cd /var/www/test\n>   git --git-dir=/home/git/test.git add <files>\n\nBut this response as\n\n````\nfatal: This operation must be run in a work tree\n`````````\n"},{"id":"171731","messageId":"20110720162208.3fa89d8b@shiva.selfip.org","threadId":"27851","inReplyTo":"20110720154644.67974a7f@shiva.selfip.org","subject":"Re: how to add files/folder from work-tree","fromName":"J. Bakshi","fromEmail":"joydeep@infoservices.in","sentAt":"2011-07-20T10:52:08Z","receivedAt":"2011-07-20T10:52:08Z","isPatch":false,"sender":{"key":"joydeep@infoservices.in","avatar":null},"body":"On Wed, 20 Jul 2011 15:46:44 +0530\n\"J. Bakshi\" <joydeep@infoservices.in> wrote:\n\n> On Tue, 19 Jul 2011 20:13:08 +1200\n> Chris Packham <judge.packham@gmail.com> wrote:\n> \n> > Oops managed to drop the Cc for the mailing list from my initial response.\n> > \n> > On 19/07/11 20:06, J. Bakshi wrote:\n> > > On Tue, 19 Jul 2011 19:53:28 +1200\n> > > Chris Packham <judge.packham@gmail.com> wrote:\n> > > \n> > >> On 19/07/11 18:30, J. Bakshi wrote:\n> > >>> Hello,\n> > >>>\n> > >>> I am using a git repo which has detached work tree. I like to add the files, folders located at the work tree ( it is a site under htdocs) at the git repo. Is it possible to do it within the work-tree or I need a separate working space from where I need to do all these operation ?\n> > >>>\n> > >>> Thanks\n> > >>>  \n> > >>> --\n> > >>\n> > >> I'm not sure I fully understand your question but what I _think_ you\n> > >> want to do is specify the path to the repository with the GIT_DIR\n> > >> environment variable. Like this\n> > >>\n> > >>  cd /place/where/files/are\n> > >>  GIT_DIR=/place/were/repo/is/.git git add <file>\n> > >>\n> > > \n> > > \n> > > I have set a git repo with attached work-tree with hook as below\n> > > \n> > > git -bare init  /home/git/test.git\n> > > cd /home/git/test.git\n> > > git config core.worktree /var/www/test\n> > > \n> > > vim /home/git/test.git/hooks/post-receive\n> > > \n> > > #!/bin/sh\n> > > git checkout -f\n> > > \n> > > Now the /var/www/test has already some files/folder. How can I add those to the repo within from its work-tree ?\n> > > \n> > > Thanks\n> > \n> > I think my initial response is correct. Try the following\n> > \n> >   cd /var/www/test\n> >   git --git-dir=/home/git/test.git add <files>\n> \n> But this response as\n> \n> ````\n> fatal: This operation must be run in a work tree\n> `````````\n\nOK, need to append also --work-tree=/var/www/test\n"}]}