Forge: git pull not updating

1.4k views Asked by At
$ git add .
$ git commit -m "commit message"
$ git push

The code gets pushed to repo as expected. However Forge deployment error message returns

branch master -> FETCH_HEAD error: Your local changes to the following files would be overwritten by merge: // ...files to change... Please, commit your changes or stash them before you can merge. Aborting

How can I resolve this? Are my commits not merged? They are on my repository. Do I need to stash? If so, what next??

Tried following other examples but unwilling to experiment without advanced knowledge of git.

3

There are 3 answers

2
Sajib Khan On

Use -A instead of . with git add

$ git add -A
$ git commit -m "commit message"
$ git push

Now, try git pull.

N.B: git add . stage modified and new files and git add -A stage modified, new and deleted files.

0
ajit On

It is good use pull before push any project just use * instead of .

$ git add *
$ git commit -m "commit message"
$ git push
0
Dazzle On

Turns out this was because recently I ran composer update inside ssh

Dont ever run composer update inside ssh. Run composer update inside VM / dev environment and run composer install inside ssh

This resulted in changing server permissions

I was eventually able to fix this with chgrp -R forge:www-data /home/forge/mysite.com