3

I'm really sorry if this has been asked before, my searching skills are bad.

So I want to update my github repo with my local code, but it always says "Everything up-to-date" So I have one file I modified, and I try

  • git add Main.cs
  • git commit -m 'Commit'
  • git push origin master

But it still says Up-To-Date even though the file on my local system is different than the one on the repo.

Thanks in advance

8
  • did you see diff between your local and remote branch?
    – itz2k13
    Commented Jun 7, 2013 at 18:46
  • What does git status say? git diff will only look at tracked files.
    – neontapir
    Commented Jun 7, 2013 at 18:49
  • yes, I have multiple differences between my remote and local. But the git diff command, I didnt try, if that has to do with this. Commented Jun 7, 2013 at 18:49
  • @neontapir "#On branch Master nothing to commit, working directory clean Commented Jun 7, 2013 at 18:50
  • 1
    When you do git config --local --list, what are the settings for remote.origin.* and branch.master.*? Commented Jun 7, 2013 at 18:51

2 Answers 2

1

It sounds to me like you may have a configuration problem.

The output of git config --list --local should contain this

remote.origin.url=https://github.com/myname/repo.git 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

You should definitely have the settings for branch.master. Also, note the protocol https:// on the remote.origin.url.

I would recommend editing your config to contain the four lines, using this command

git config --local --edit

When you manually edit the file it should look like this

[remote "origin"]
    url = https://github.com/myname/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
4
  • @somerandomguy definitely not --global, since that will set it for all your Git repos. Use --local to set it for the current repo only. Commented Jun 7, 2013 at 18:58
  • Ah how do I make a new line in vim? also where do I put those lines? NVM figgured it out Commented Jun 7, 2013 at 19:00
  • I added those lines, but now I can't do anything it always says "fatal: bad config file line 15 in .git/config" Commented Jun 7, 2013 at 19:11
  • If there are previous settings under the headings [remote "origin"] or [branch "master"] you should remove those. If there are multiple such headings, you should only have one of each. Commented Jun 7, 2013 at 19:13
0

I am also currently going to the Udemy class - "GitHub Ultimate: Master Git and GitHub." In reference to your previous problem, I ran into the same problem. I found in VS Code, with Autosave on, you can simply click on the file in your VS Code editor and make the changes. When you enter 'git status', your response will be 'modified: filename.ext' (In the case of Udemy, 'modified: README.md')

1
  • Welcome to Stack Overflow. It seems your answer does not directly address the question as the question relates to local and remote repository synchronisation. Thus i suggest you to remove your answer.
    – Zilog80
    Commented Dec 3, 2022 at 17:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.