Reputation: 417
On the server, /home/git/xxx/hooks/post-receive:
#!/bin/bash
cd /var/www/xxx
git pull
On the server, /var/www/xxx was created like this:
cd /var/www
git clone /home/git/repositories/xxx.git
When I run "git push" on the client, got this message:
remote: fatal: Not a git repository: '.'
Any ideas?
Upvotes: 2
Views: 3450
Reputation: 4503
Per your comment, you want to automatically update a website when changes are pushed to a Git repository. Try this: http://www.ekynoxe.com/automated-deployment-on-remote-server-with-git/
Note that the website root directory (/var/www/xxx
) is not a Git repository itself; it just holds the working tree.
Upvotes: 1
Reputation: 4086
As described here, the problem is that GIT_DIR
is set to .
when the hook is called.
If you unset GIT_DIR
in the post-receive hook, it should work:
#!/bin/bash
unset GIT_DIR
cd /var/www/xxx
git pull
Upvotes: 5
Reputation: 4690
You are missing the pulled directory,
cd /var/www
git clone /home/git/repositories/xxx.git
Above command will create a new directory under /var/www as xxx, Provided your application name is xxx.
Now you need to go in this newly created directory like,
cd /var/www/xxx
Now run the command "git push". This should work.
Upvotes: 0