8

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.

RVA
  • 95
  • 1
  • 1
  • 11
  • Did you commit first? – Willem Van Onsem Aug 11 '14 at 15:16
  • what are the outputs of `git remote -v` and `git branch` – Luceos Aug 11 '14 at 15:29
  • origin ssh://xx.xx.xx.xx.xx/url/x.git * production – RVA Aug 11 '14 at 15:35
  • I did commit first... – RVA Aug 11 '14 at 15:37
  • Is your "private repo" that appears to not see the changes a bare repository or a normal one? `git push` will not update the working directory of the remote it pushes to, only the object store... And, in fact, if you attempt to push to the branch that is currently checked out in the remote, it should fail... – twalberg Aug 11 '14 at 16:59
  • If it should fail, should I have an error message ? How could I know if the repo is a bare repo or a normal one ? – RVA Aug 11 '14 at 17:34
  • If `git config --get core.bare` run in that repo reports "false", then there is an associated working directory. And, yes, attempting to push the currently checked-out branch to a non-bare repository should produce a message. But pushing a different branch will succeed, but won't update the working directory. – twalberg Aug 11 '14 at 17:50
  • Should I run it in my working copy or on the server ? How could it work previously if it's a not bare repo?? – RVA Aug 11 '14 at 18:10

3 Answers3

5

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
inquiring minds
  • 1,785
  • 2
  • 15
  • 16
1

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

  • ...

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
  • I did git commit first, git branch tells * production et git remote tells nothing special – RVA Aug 11 '14 at 16:26
  • What version of `git` are you running? – Willem Van Onsem Aug 11 '14 at 16:50
  • How do you inspect your remote? By default, the remote will be on the `master` branch, so you will need to `git checkout production`... – Willem Van Onsem Aug 11 '14 at 17:00
  • I'm running the 1.9.4 v? In fact, my remote worked fine since yesterday, when I pushed, everything was broken. Do I have to connect into the remote physically to do the co ? – RVA Aug 11 '14 at 17:32
0

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.

Community
  • 1
  • 1
Fxyang
  • 293
  • 3
  • 6
  • 12