-1

Been using Git for a while now but only just created a Github account. I've setup a repo but I keep getting errors when I try to push to it.

error: failed to push some refs to 'https://github.com/username/myrepo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I've tried doinggit pull but then I get Pull is not possible because you have unmerged files.

Any ideas?

JJJ
  • 32,902
  • 20
  • 89
  • 102
tommyd456
  • 10,443
  • 26
  • 89
  • 163
  • It means that you're still in a merge locally - you need to resolve the merge before you go to pull. – Amber Jun 20 '14 at 18:44
  • Possible duplicate of [Git Pull is Not Possible, Unmerged Files](http://stackoverflow.com/q/15127078/456814). –  Jun 20 '14 at 18:57

2 Answers2

0

check the diff between your stuff and the remote repository http://git-scm.com/docs/git-diff and then merge the files that you want merged, or if you don't have anything that you need in your local you can git checkout . to remove your changes and then git pull to pull the remote repository as it is.

pooopies
  • 78
  • 8
0

There are a bunch of solutions to a similar question that I think would apply here. The easiest one is to back up your local repo to some other folder, then run:

git fetch origin
git reset --hard origin/master

The answer I linked to also has a technical explanation of why.

Aside from that, git status is your best friend.

Community
  • 1
  • 1
shadowtalker
  • 12,529
  • 3
  • 53
  • 96