You can follow this user guide section of git push (to a GitHub repo), adding a remote with the ssh address of your GitHub repo:

See also this tutorial to push your local project to that GitHub repo.

Answer from VonC on Stack Exchange
🌐
Vogella
vogella.com › tutorials › EclipseGit › article.html
Eclipse Git Tutorial
May 31, 2026 - Copy the URL from GitHub and select File Import Git Projects from Git in Eclipse. Eclipse fills out the fields based on the URL in the clipboard. Enter your user and password to be able to push to GitHub. Alternatively, you can use an SSH key. You can configure your SSH key in Eclipse via Window ...
🌐
Eclipse
wiki.eclipse.org › EGit › User_Guide
EGit/User Guide - Eclipse Wiki
Click Next and on first connection accept GitHub's host key. Enter your SSH key's passphrase and click OK. On the next wizard page click Add all branches spec to map your local branch names to the same branch names in the destination repository (on a one-to-one basis). Click Next. The push confirmation dialog will show a preview of the changes that will be pushed to the destination repository.
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-export-eclipse-projects-to-github
How to Export Eclipse projects to GitHub? - GeeksforGeeks
July 23, 2025 - Step 4: Drag and Drop the files you want to commit from Unchanged Changes to Staged Changes. Step 5: Write the commit message in "Commit Message" and click "Commit and Push". Step 6: Fill in your UserID and password of GitHub and click "Log in".
🌐
GitHub
github.com › maxkratz › How-to-Eclipse-with-Github
GitHub - maxkratz/How-to-Eclipse-with-Github: A tutorial on how to use Eclipse with GitHub. · GitHub
Drag all entries from the field Unstaged Changes(n) to the field Staged Changes(m). Write a nice Commit Message like This is my first commit. Click Commit and Push.... Click Next. Click Finish. Eclipse prompts you with a message that the data is pushed.
Starred by 47 users
Forked by 18 users
🌐
Introcomputersciencetutoring
introcomputersciencetutoring.com › eclipse-project-to-github
Push Eclipse project to GitHub
Under the Quick setup section, copy the SSH URI. It might be necessary to click the SSH button. The SSH URI begins with git@github.com:. GitHub SSH URI · In the Eclipse Git Repositories view, select the Clone button.
🌐
Makeseleniumeasy
makeseleniumeasy.com › 2023 › 05 › 17 › how-to-push-code-from-eclipse-to-github-repo-using-access-token
How To Push Code From Eclipse To GitHub Repo Using Access Token?
May 17, 2023 - Drag a file/s from “Unstaged Changes” to “Staged Changes“. Give a meaningful commit message and click on the “Commit” button. Perform Right-click on Project -> Team -> Remote -> Push · Copy and paste GitHub URL in the URI field as shown below. Values for the Host and Repository ...
Find elsewhere
🌐
JD Bots
jd-bots.com › 2021 › 03 › 25 › push-your-code-to-github-repository-from-eclipse
Push your Code to GitHub Repository from Eclipse - JD Bots
September 10, 2021 - Initially, changes are in Unstaged Changes. This has to be moved to Staged changes before Commit. Select all files or add individual files. Give a commit message and author & committer details. Click on Commit and Push.
🌐
Stack Overflow
stackoverflow.com › questions › 68630221 › how-to-commit-and-push-eclipse-project-to-github
How to commit and push Eclipse project to GitHub? - Stack Overflow
What exactly did you do in the Git Staging view to push? What push URI do you have configured (in Git Repositories view right-click the push node below Remotes > origin and choose Configure Push...)? Did you configured the same SSH key in GitHub and in Eclipse on your local computer?
🌐
Medium
medium.com › @sudha.ramanantham › how-to-push-a-project-from-eclipse-to-a-remote-github-repository-0bf2626c7574
How to Push a Project from Eclipse to a Remote GitHub Repository Via Eclipse | by Sudha Ramanantham | Medium
June 19, 2025 - Before proceeding, go back to your GitHub repository page and copy the remote repository URL. Then, return to Eclipse, right-click on your project, navigate to Team, and select Push Branch ‘master’… to start pushing your code to the remote repository.
🌐
Medium
medium.com › @dilsh7 › how-to-add-eclipse-project-to-github-how-to-commit-push-pull-from-eclipse-to-github-19037daab100
How To Add Eclipse Project To GitHub | How to Commit, Push, Pull from Eclipse to GitHub | by Madhuk Dilhan | Medium
November 10, 2023 - Add all of the existing project’s files to the Git index and then commit. Add the GitHub repo as a remote reference for the existing project. Perform a git push operation with the -u and -f switches.
🌐
Automationstepbystep
automationstepbystep.com › home › how to add eclipse project to github | how to commit, push, pull from eclipse to github
How To Add Eclipse Project To GitHub | How to Commit, Push, Pull from Eclipse to GitHub - Automation Step by Step
October 9, 2018 - Notes: Today we will learn: 1. How to create github repository 2. How to clone repository in eclipse 3. How to add eclipse project to github repository 4. How to commit, push and pull the changes Step 1 Create GitHub account and SignIn Step 2 Start a Project = Create a repository Step 3 Start ...
🌐
Medium
medium.com › @vidhyamanickaraj › how-to-upload-the-maven-project-from-eclipse-to-github-1b3db06fb8cb
How to upload the Maven Project from Eclipse to Github | by vidhya manickaraj | Medium
October 16, 2023 - Pushing the changes to the Github repository is done by selecting Window > Show View > Git Staging > Open.Mvn clean should always be performed before committing any code.There are numerous files in the unstaged changes.Drag and drop the files ...
🌐
DEV Community
dev.to › s3cloudhub › how-to-push-eclipse-project-to-github-3nkc
How To Push Eclipse Project To GitHub - DEV Community
October 9, 2024 - Eclipse IDE: Make sure you have Eclipse installed on your system. Git: Ensure that Git is installed and configured. You can download it from git-scm.com. GitHub Account: Sign up for a free account on GitHub if you don’t have one. 1. Log in to GitHub: Go to github.com and sign in.
🌐
o7planning
o7planning.org › 13083 › bring-an-eclipse-project-to-github-as-an-repository
Bring an Eclipse project to GitHub as an Repository | o7planning.org
Then on Eclipse, right click on your project and select: Team > Share Project... > Git ... Then click "Create Repository". As a result, your project folder turns into a "Local Repository". What you need to do next is link "Local Repository" to "GitHub Repository".
Top answer
1 of 1
8

I believe your problem may be that your git repo in Eclipse is in the parent folder of the project. What you need is for your git repo to be in the project folder.

Now, Eclipse seems to recommend that Git repos be set up in the parent folder of their projects. I am guessing that this is so that later related projects that may be needed can be easily added to the git repo. If you're not worried about that, and just want it to work as you described, see below.

Note that I'm running Ubuntu Linux, and so my Eclipse and desktop will probably look different from yours.

First we're going to find out if my guess as to the problem is correct:

  1. Open the "Git Repository Exploring" perspective in Eclipse.
  2. Look at the "Git Repositories" view. See if the path given for your repository is pointing to the folder containing your project. If it is, continue with the instructions below.

If your repo is in the folder above your project, then the problem shapes up like this: Git will recreate all the paths in your repo relative to the repository itself when you push it to GitHub. If it is in the folder above your project, then all the paths will include the folder containing your project. So, you'll need to move your repo into the folder containing your project. I'll describe the steps to achieve that below.

  1. To begin, you'll want to make sure you don't have any uncommitted changes, or any stashed changes (if you don't know what stashed changes are, don't worry about them).
  2. As a matter of caution, you may want to create a complete copy of your current code & repository at this point if it's at all important.
  3. Open Windows Explorer and navigate to the folder containing your git repo, per the path given in the "Git Repositories" view.
  4. At this point, you may want to close Eclipse, to avoid changes startling it (they shouldn't, but "you never can tell with bees!")
  5. If you can see a .git folder in Windows Explorer, then go on to the next step. If not, you'll need to show hidden files. http://windows.microsoft.com/en-US/windows7/show-hidden-files gives instructions for Win7.
  6. Now you should be able to see a .git folder. Copy this into your project folder.
  7. Start Eclipse (if you closed it) and open the "Git Repositories" view again.
  8. Click the button to add an existing local git repository. Choose the project folder.
  9. Go back to the normal Eclipse Java perspective. Right-click your project and choose Team > Disconnect to temporarily stop heeding the old repository.
  10. Right-click on the project again and choose Team > Share Project.... When prompted for a repository, check the box to use the one in the project/parent folder. In the view below, check the box of the one which is directly within the project folder (it will probably have one dot next to a folder.) Then click the Finish button.
  11. Now you'll probably have a lot of catching up to do. Git will believe that you have deleted every file in your project and replaced it with a file with one less layer of directory path. You'll need to commit all those changes to get a clean repo.
  12. Push the changes from step ten to GitHub. Check that it looks as you expect.

I hope this helps. Please comment if something's unclear or there's another issue. Please make sure to have a backup before you try this... I've not tested it entirely, and I don't want to cause any unneeded grief.

🌐
Medium
medium.com › @fallensky › pushing-eclipse-project-to-github-966d837d3b46
Pushing Eclipse project to GitHub | by Sakshi Kulshreshtha a.k.a FallenSky | Medium
October 22, 2024 - Once you have done this the “push branch master” option under Team will be enabled to click on. Once you click this button, you need to provide the details of the remote repository in the pop up window. You need to provide the URL of the repository and the login details that will be your username and your personal access token. To get one you need to go your GitHub page on the browser, click on your profile picture-> settings -> developer settings -> personal access tokens.