I tried to push my code to github (by the Eclipse), and I encountered a problem.

I did the following steps:

  1. On my project (in Eclipse) : right click > team > share project > click on "git" > next.
  2. In configure git repository dialog:

    • Check: use or create repository in parent folder of project
    • Click on the line inside the table, this will enable Create Repository button.
    • Click Create Repository button.
    • Click finish
  3. Connect project to remote repository previously created on Github:

    • Copy remote repository URL from github.
    • Go to Git perspective in Eclipse:
    • On Git Repositories view:
    • Go to Remotes section, right click it and choose Create Remote…
    • On New Remote dialog ­ click OK
  4. On Configure Push dialog:

    • Push URIs section ­ click add
    • On Destination Git Repository ­ paste the URL copied from github into URI text field.
    • Press Finish.
  5. Ref mappings section ­ click add.
  6. On Create or Edit Refspec, Remote branch text field: type “refs/heads/master”.

    • Check "force update".
    • press OK.

In order to push your code to github:

  • in Eclipse ­ right click on project name
  • choose: Team | Push to upstream

After all that, I got this error:

deletion of the current branch prohibited
error: refusing to delete the current branch: refs/heads/master


How can I solve this problem?

1 Answer 1


Sorry, but your question is formated very bad which makes it hard to read.

I'd do the following:

  • clone the project from github (using git console, tortoise git or SourceTree)
  • Import the project in eclipse (import existing project into workspace)
  • The eGit plugin will detect that this is a git project and automatically share it during the import
  • You can now use the eGit plugin to pull/comit/push etc..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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