Git push doesn't fail but doesn't work

孤街浪徒 提交于 2019-12-20 01:37:17

问题


I'm using Git and I'm in front of a several problem: I can push, my coworkers can pull it, and the opposite. But the version which is on the remote is not up-to-date: if I write a TEST in the html, nobody could see it except on the local version... I thought it could come from the branch which is on the remote... isn't it ?

EDIT 1 : I'll try to be more specific: I've a private repo which is on a private server. This server is used to host the website. When i commit -> pull -> push everything works great. When my coworker do the same, it's fine. On our local version, all the changes appear like my "TEST" test. But on the server, nothing is up to date. Is it the wrong branch, on the server or something?

PS : Sorry for my english, it's not my native language.


回答1:


If you are doing a plain 'git push' you may need to do 'git push origin branchname' instead. Provided the file is committed, of course.

UPDATE: Check your .git/config file. You should have an origin specified and your branch should refer to origin. Maybe there is a mismatch.

[remote "origin"]
    url = [your github repo]
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "yourbranch"]
    remote = origin
    merge = refs/heads/yourbranch



回答2:


The question is quite unclear, but several things can go wrong.

  • You need to git commit changes first. Otherwise your changes are simply not stored (unknown to git).

  • You've committed on a special branch. In that case the commits are actually stored on the server, but not shown by default. Other users can the checkout the branch by performing

    git checkout <branch>
    

    detecting on which branch you are yourself can be done with

    git branch
    
  • You and your workers use different remote servers. You can check this by running

    git remote
    

    to generate a list of installed remotes

  • ...




回答3:


I had the same problem which looks really similar to what Vautrinr had. I also committed and had the same response to some of the things suggested in the previous answers.

The final solution to my problem comes from this awesome answer. It turns out that my HEAD was detached and all the commits I did didn't go into the master branch. When trying to push to remote server, git failed to find any difference between the two master branches and thus "Everything up to date." After fixing the detached HEAD problem, I was finally able to push my changes.

Hope this help.



来源:https://stackoverflow.com/questions/25246589/git-push-doesnt-fail-but-doesnt-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!