0

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.

Bomzan
  • 36
  • 6
  • Hey, a couple of quick questions that would really help get an answer on this. First, can you specify the exact commands you wrote? It isn't 100% clear to me what steps you took and I imagine that knowing the exact commands/steps will help clarify. Also, can you provide the short hash of both `feature` and `stage` on both your local, origin, and the server side? – PhiloEpisteme Jul 18 '19 at 13:58
  • @PhiloEpisteme First, I created a new branch(feature) from stage [git checkout -b stage feature]. I added new files and changed some codes to feature and pushed to bitbucket repo. For the merge, I did bitbucket merge from feature to the stage branch. After that in the local stage branch, I did git pull. The I pushed to production server. The shorthash at origin is ae228b9 and the local is also ae228b9. The production server is also at the same hash. – Bomzan Jul 19 '19 at 05:50

2 Answers2

0

I solved this by deleting the contents of the project folder and pushing again with some new changes.

Bomzan
  • 36
  • 6
0

I faced the same issue(Azure deployment)

There are two ways to ways to handle this -

  1. Increase timeout setting (but deployment may stuck some times)
  2. Push new changes (redeployment)

I prefer 2nd option.

Omkar
  • 110
  • 3