I searched through questions but it did not answer my question still.
Most of them suggest to set permissions, so the file could be executed. Done that - set to 777.
Transport protocol has to be not http, but ssh. I hope it is, in the git extensions I checked browse repositories - it is starting with [email protected] so it should be ssh protocol.
post-receive simply looks like this:
#!/bin/sh -x
echo 'test';
git log -1 HEAD --pretty=format:"%x09%ad%x09";
touch ~/repos/develop/dashboard/test.txt;
So when I run git pull, those should be executed.
I tried to rename post-receive to post-checkout - then it was executed when calling git checkout.
But with git pull - post-receive is like ignored.
Also some mentioned noexec partitions. But I hope that if post-checkout is working, then this also has to be working, because post-checkout also needs to be executed.
What else should I check?
Update:
I will tell why I choose this hook, and maybe you can suggest another way.
I want on git pull to call some link which will save the current date to the database. So when user opens website - he could see when the website was last updated, so I would not need manually set the time on each site update.
Update: Ok, I see interesting line:
These scripts run before and after pushes to the server.
I push to server from my computer which I write code. How can my ubuntu server know that I have pushed? Should I put the post-receive file in my computer which I program and push? I can try, but somehow it looks impossible that it will help.
Update
Tried putting post-receive in my computer which I use to push and as I expected - no test.txt was created in ubuntu server, nor in my computer.
Update
How I achieved what is to use post-merge hook. It is client side category. My server is a client relatively to bit bucket it means. So when I pull to my server, merging is done and so my script is executed.
These scripts (pre-receive, post-receive and update) run before and after pushes to the server, not on client side.
So you need to check out client side hooks.
tldr; There is no specific hook after git pull.