Search code examples
gitcommitgit-pushgit-clonegit-remote

How I can update changes on remote git repository?


I finished to commit and push changes on remote git repository but when I view remote repository's files, these are outdated. I'm using Git Bash.

View image

The red text are changes made in repositories clones. These changes aren't reflected in the original repository's physical file

How I can do to reflect the changes?


Solution

  • I assumed that you are pushing to a branch that the remote currently checking out. Because it seems like a non-bare repository, and have files checking out in your description.

    I made some simple tests to simulate such push, and the following message displayed:

    remote: error: By default, updating the current branch in a non-bare repository
    remote: error: is denied, because it will make the index and work tree inconsistent
    remote: error: with what you pushed, and will require 'git reset --hard' to match
    remote: error: the work tree to HEAD.
    remote: error: 
    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    remote: error: its current branch; however, this is not recommended unless you
    remote: error: arranged to update its work tree to match what you pushed in some
    remote: error: other way.
    

    If you're sure you do the push successfully(that will be reject at default), then you have to execute following at the remote repository.

    git reset --hard