0

I have a Drupal site with three enviornments:

  1. dev - vagrant-based dev environment running on VM
  2. stg - mirrors the production environment. before deploying the code live on the production,
    it's deployed on stg to make sure everything works
  3. prod - live site

The version control system is git. After coding is done, I commit the code to the git repository and push the code to origin master i.e. git commit -m <msg> and git push origin master. After that, it's deployed to staging as git push staging master. For production, it's git push production master.

A few weeks back, I had to make some code changes directly to the production server. Now, whenever I try to push anything to prod through the normal push cycle, it fails. I can code on dev, push to origin master and staging but not to prod.

When I try to push, I get the following results:

Counting objects: 148, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (85/85), done.
Writing objects: 100% (126/126), 1.20 MiB | 169 KiB/s, done.
Total 126 (delta 52), reused 107 (delta 35)
remote: error: packfile <path-to-packfile> cannot be accessed
remote: error: hook declined to update refs/heads/master To ssh://admin@<site-name>.com/shared/repositories/dlc_drupal.git ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'ssh://admin@<sitename>.com/shared/repositories/dlc_drupal.git'

What could be the problem and how could I correct my prod git push?

Any help would be highly appreciated. Also, I might have missed some details as I am not sure if they would be relevant. Please let me know.

Steve Czetty
  • 6,147
  • 9
  • 39
  • 48
Rahul
  • 31
  • 2

1 Answers1

0

It may not be a fast-forward merge on your production server. I don't know exactly how you have it set up to check out, but

 git checkout -f 

will force it to check out. That may or may not be what you want depending on your situation. Basically since you made direct changes on the server, that git repository is no longer in the same normal flow as the others. You should try to save those changes locally, reset them on the server, and then try pushing again.

jkeesh
  • 3,289
  • 3
  • 29
  • 42
  • Whatever changes were made to the production directly are in the origin master as well. Basically, content-wise, both the production and repo are consistent. But, I just can't push to prod now. Currently, I make the changes on my dev, test them, commit them to git and copy them over to the prod manually. – Rahul Sep 11 '12 at 23:09
  • You say "you just cant push to prod now"---but does it give you any sort of message like `To prevent you from losing history, non-fast-forward updates were rejected`? It seems you could force a push using `git push production +master` as mentioned here http://stackoverflow.com/questions/5667476/git-non-fast-forward-rejected – jkeesh Sep 12 '12 at 07:34
  • I get the following: Counting objects: 148, done. Delta compression using up to 8 threads. Compressing objects: 100% (85/85), done. Writing objects: 100% (126/126), 1.20 MiB | 169 KiB/s, done. Total 126 (delta 52), reused 107 (delta 35) remote: error: packfile cannot be accessed remote: error: hook declined to update refs/heads/master To ssh://admin@.com/shared/repositories/dlc_drupal.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to 'ssh://admin@.com/shared/repositories/dlc_drupal.git' – Rahul Sep 12 '12 at 21:02