kojiro
kojiro

Reputation: 77137

What causes this git warning?

Lately whenever I do a git push I get an exchange like this:

owner-pc ~/dev/project $ git push
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 3.15 KiB, done.
Total 8 (delta 6), reused 0 (delta 0)
remote: Pulling changes into edge...
remote: From /var/git/project
remote:  * branch            master     -> FETCH_HEAD
remote: error: Your local changes to 'config/development.php' would be overwritten by merge.  Aborting.
remote: Please, commit your changes or stash them before you can merge.
remote: Updating 1984db9..d584535
remote: Changes have been pulled and applied to edge.
To ssh://dev.trueaction.com/var/git/project
   a3a085e..8ec5b07  styleguide -> styleguide

…but the push apparently completes without error, and everything works fine. There are no local changes to config/development.php, nor have their been for some time. I don't get any errors or warnings on commit, only on push, and not on pull.

What causes the error? (It behaves like a warning, but says it's an error, so I'm going with that term.)

Upvotes: 1

Views: 186

Answers (2)

manojlds
manojlds

Reputation: 301167

The "error" is happening in a post(-receive) hook ( as evidenced by the remote: prefix) where the hook is pulling the code you pushed into some other repo and that repo has some local modifications that is causing the error.

Since post-receive hooks do no affect the outcome of the push ( since they happen after the push ), the push itself has gone fine, but the pull that the hook attempted as part of the post-receive has failed due to the local changes.

Find where the pull is happening ( in /var/git/project/hooks/ find a post-receive or some other hook that is active and see what it is doing ) and remove the local modifications there.

Upvotes: 1

favoretti
favoretti

Reputation: 30167

Judging from your output - you're pushing to a non-bare repo, and someone edited config/development.php on the remote. This is what generates the exchange you're seeing.

Upvotes: 1

Related Questions