问题
This is my .git/config
configuration file in my repository:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:<username>/<repository>.git
fetch = +refs/heads/*:refs/remotes/origin/*
[user]
name = <username>
I have correctly configured my public ssh key in github. I pushed my changes into this repository from another machine, which where correctly updated into github.
However in my current machine, when I make a git pull request:
git pull origin master
It says "already up to date"
When it's not the case at all, the updated files in my github repository are not in my local repository.
What can I be doing wrong?
UPDATE:
I've tried the following from the answer from Olivier Refalo:
In github and in local the branches are master.
The output to the command:
git for-each-ref --format="local: %(refname:short) <--sync--> remote: %(upstream:short)" refs/heads
Is the following:
local: master <--sync--> remote:
git remove -v
returns the following output:
origin git@github.com:username/repository.git (fetch)
origin git@github.com:username/repository.git (push)
回答1:
Multiple things can happen here:
I would trust git, the remote is in sync with your local. The problem here is that it may be pointed to a different location than want you think.
- you may be pushing local branch XYZ (not master) to origin/master
- you may be pushing to a different URL
to figure this out, run the following code:
- git branch, make sure you are on master
- git for-each-ref --format="local: %(refname:short) <--sync--> remote: %(upstream:short)" refs/heads
- git remote -v
The later will show an association table showing which local branch syncs with which remote. Finally the latest statement shows your remote urls.
I took these commands from a project of mine G2
回答2:
I didn't find out what was the problem so what I did was a new git clone from github in order to get the updated files.
回答3:
try ot use force pull. add "force" between git and pull
来源:https://stackoverflow.com/questions/12086897/git-pull-from-my-public-repository-not-working