0

I am creating a totally new OSS project for my organisation and I want to host it on GitHub. The project will be developed using Eclipse and I am using EGit. I have no prior experience with Git, as I've previously only used SVN.

Here's what I did so far:

  • Created a new account for my organisation on GitHub. (I already had a personal account.)
  • Created a new repository under my organisation's GitHub account for this project.
  • Under the new repository's "Collaborators" section, added my personal account. (I verified this in my personal account.)
  • Installed EGit into my Eclipse. (I am using Eclipse 4.2 with EGit 2.0.0)
  • Created a new Eclipse project in a new Eclipse workspace. (It's a Maven project so I created it through m2e but that shouldn't make a difference.)
  • Added the new Eclipse project to a new Git local repository (via Team -> Share Project).
  • Created the .gitignore (ignores Eclipse-specific files and directories).
  • Added source to the project (via Team -> Add to Index).
  • Committed local changes to my local repository.
  • Copied the HTTPS URL from GitHub.
  • Team -> Remote -> Push
  • The URL from the clipboard was already taken and most fields populated.
  • Entered username and password for my GitHub personal account, clicked Next, data was fetched successfully.
  • Selected "refs/head/master" from the Source ref dropdown (I didn't understand this entire page, maybe I've put something wrong?)
  • Clicked "Add Spec" and then Next

At this point, I got the error "master: master [rejected - non-fast-forward]"

I searched on Google, but the suggested resolution was to do a Pull. I tried "Team -> Pull", but got the error "The current branch is not configured for pull; No value for key branch.master.merge found in configuration"

Can anyone help me? My remote repo is still empty (save for the .gitignore and the README.md). I want to get files from my local into that remote repo!!

Adam Burley
  • 5,551
  • 4
  • 51
  • 72
  • I just started doing this myself based on this video http://youtu.be/U1kXlahkwd4 which goes up to just before the last two steps you have (select master & add spec) and all seems to be working fine, maybe you went a step too far? If you project is empty it could be worth deleting the local repo and starting from scratch? – Toby May 20 '13 at 10:42

1 Answers1

0

That looks like there is already committed content in your Github repository. I don't exactly know what is going wrong, but I would do it different:

  • First install Mylyn and the Mylyn GitHub connector in Eclipse. That way you can access github repositories much easier.
  • Use the Mylyn Github connector to clone your existing (assumed to be empty) Github repository into a new local repository (File->Import->Git->From Github). That is the easiest way to verify your login credentials, ssh keys and so on.
  • During the previous cloning step, the github repository was automatically added as "upstream" repository reference to your local repository. So if you now add files to your local repository, you can commit them and afterwards use "Push to upstream" to make them available on Github. No configuration of the remotes and refspecs is necessary in that case.
  • Now create your new Eclipse project and share it using the Team -> Share, where you select your existing local repository.

Everything beyond that would be as you already described.

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
  • actually, it wasn't technically empty, I've updated my original post. could that be the problem? I'm not sure about all this "MyLyn" stuff, I prefer to use EGit. – Adam Burley Jun 29 '12 at 18:28