1

My English is not very good. Please bear with me.

I had search this question on stackoverflow and google.But also can't solve this question.

I just want to build a auto deploy enviroment through git hooks.But it's doesn't work.

I use Ubuntu 12.04 server as server on one computer,I call it PC-Ser. And I use a Windows 7 PC as client on other computer,I call it PC-C.

And I install gitolite on PC-Ser with:

  1. apt-get install gitolite
  2. addgroup gitolite
  3. adduser --disabled-password --home /home/gitolite --ingroup gitolite gitolite
  4. su gitolite
  5. gl-setup /tmp/user.pub

Then I

"git clone gitolite@PC-Ser:gitolite-admin"

on PC-C.

I create a repo named autoDeploy through edit gitolite.conf file and push it.This is gitolite.conf:

repo    gitolite-admin
        RW+ = admin

repo    autoDeploy
        RW+ = @all

After that,I do someting on PC-Ser:

cd /var/www
git clone /home/gitolite/repositories/autoDeploy.git

And then I edit /home/gitolite/repositories/autoDeploy.git/hooks/post-receive:

#!/bin/bash
cd /var/www/autoDeploy
pwd >> /log/pwd.log
git push /home/gitolite/autoDeploy>> /log/push.log 2>&1
echo "finish" >> /log/finish.log
whoami >> /log/user.log

And then, I creat a test.txt on PC-C.autoDeploy and I push it.

But /var/www/autoDeploy have not pulled.It does not work.

There have this on PC-Ser's log:

/log/pwd.log:

/var/www/autoDeploy

/log/push.log:

fatal: Not a git repository: '.'

/log/finish.log:

finish

/log/user.log:

gitolite

I try run the /home/gitolite/repositories/autoDeploy.git/hooks/post-receive by root,it's success,/var/www/autoDeploy has pulled.

Then I "su gitolite" and run /home/gitolite/repositories/autoDeploy.git/hooks/post-receive,it's also success.No error./var/www/autoDeploy has pulled success.

Please help me.Thanks a lot!

nullless
  • 11
  • 1
  • Take a look at: http://stackoverflow.com/questions/10507942/git-checkout-in-post-receive-hook-not-a-git-repository – NITEMAN May 01 '14 at 20:07

0 Answers0