I have a post-receive hook in my server. I also have a remote repo(origin) (branch:stage) where another developer pushes to. I pull the commits and push them to production from my local computer.
I recently created a new branch(feature) from the latest head of the existing branch(stage), added some code and pushed the feature branch to remote repo. I merged the new features from feature branch to stage branch.
Then I pulled from the remote repo to local. Now, I pushed the stage branch to production. My post-receive file consists:
git --work-tree=/path/to/project --git-dir=/path/to/project.git checkout -
f stage
My head in the remote repo after merge is currently at ae228b9. And, at the remote production hook's latest logs also points to ae228b9.
The problem is that the code from the merge are not seen in the production server.
Do I have to do something else to get the merged code to production?
After I pulled from origin and pushed to production, I tried changing the new files locally, committed them and push to the server. But, the changes are not reflected in the server.
Edit: Also, I uninstalled apache php mysql and installed them again. Before the unistallation/installation, the home page was showing in server but the routes were not working(404 error) but the git hook was working. After the unistallation/installation, the git hook stopped working
Update: I created a new hook with the same code as above. Now during the push I get:
remote: error: unable to unlink old '.gitignore' (Permission denied) remote: error: unable to unlink old '.htaccess' (Permission denied) remote: fatal: cannot create directory at '.idea': Permission denied
I tried the following code inside my project folder and project.git(hook) folder:
sudo chmod -R ug+w .;
unable to link after which the push is a success but the changes are not reflecting.
I solved this by deleting the contents of the project folder and pushing again with some new changes.