0

I have successfully created a git hub repository, a local master, committed the initial changes and pushed them to github.

Unfortunately the project folder from Eclipse ends up in the repository. For example:

<username>/<gitrepositoryname>/<eclipse project folder>/<project files & README>

when for most people it looks like:

<username>/<gitrepositoryname>/<project files & README>

I created a new local master after I found this tutorial Push eclipse project to GitHub with EGit

but now I am running into push problems such as "HEAD rejected - non-fast-forward" when using the new local master.

Can some please help me to correct this locally/remotely? Is there a way to switch local master branches so that I can sync the correct one with githib?

Thanks in advance.

Community
  • 1
  • 1
AnonPyDev
  • 67
  • 7

1 Answers1

0

It's pretty simple to fix:

  1. Go to the "workspace" where you keep <eclipse project folder>
  2. Make sure to delete the .git folder there
  3. Tell git to force push the changes. (Checkbox) (It's usually not good to force git to do something, because you could loose commits/data BUT here, we really want to overwrite the old repository with the new one.)

Eclipse git push dialog

  1. Your changes should be up immediately. Next time you push, please make sure, the force push checkbox is disabled again
0xpentix
  • 732
  • 9
  • 22