Share eclipse java project on github - eclipse

I am trying to push a eclipse java project to github. That is how I am trying to do it:
In the "git repositories" view, I added my repository, I just created on github:
https://github.com/xxx/SpringTest.git
Now I want to share my project to that git repository. I do that by right click on the project -> team -> share project...
I select my repository, but the next button is greyed out. What am I doing wrong here?
Edit: "Next" and "Finish" is greyed out:

Following the Egit manual, the Next button is always greyed out at this point:
You would need to click on Finish in order to complete the process.
You just need to be sure you have a git repo already initialized where your project is.

Related

How to select repository for staging view in Eclipse Luna 4.4?

I'm not able to find a solution to a documented bug in Eclipse (Luna 4.4). I've cloned a git repository from Github into my eclipse workspace view and imported the associated Maven project into my project space. When I then display the staging view in Eclipse, it appears, but says "No Repository Selected" up top. I'm therefore unable to drag any changed files into the staging area and commit them. How do I associate my cloned repository with the staging view?
Try enabling linking between the Git Staging view and other views. You do so by pushing the "Link with Editor and Selection" button on the top right of the view, to the right of the "Refresh" button.
In the top image, the view is not linked.
In the bottom image, the view is linked and the button appears "pushed"
"Enabling linking between the Git Staging view and other views" didn't help in my case. I also tried deleting branch and checking out again. Nothing worked.
What I did was:
Right click on any of the modified file -> Team -> Commit.
Somehow it worked and I could see all modified files in unstaged changes.
I had the same issue. This is what worked for me
- Under the 'Package Explorer' Right click on the your project
-> Team -->Share Projects...
-> Then in the list of projects, select your project
* Seems weird, but sharing back to itself resolved this issue for me
Good Lucks
click on git icon,
select the repositorie you want to use
right clik to show the menu
then select "show in"
then select "git staging"
Maybe you are missing one step. If you have a local repository already:
1. On "Quick Access" of your Eclipse search Git repository
2. Select Team option (Right click on project -> Team) and select Share Project, mark Use or create...and select .git directory of your project cloned.
3. Select Team option and now select Add Index
4. Select Team option and now select Commit, you will see Git View now has your project with the correct branch.

Eclipse Kepler: How to share an existing project to an existing remote Git repo?

I currently Eclipse Kepler on my new computer with EGit. And I have a particular project on it, not linked to any repository.
Now there is a remote Git repository (with all the account and password information at hand) someone else created for me and I want to push this project onto it. Since I never used Git on eclipse before, I figured it may be somehow similar to my limited experience with CVS - so I tried: right click -> team -> share project -> Git (I read somewhere that I should select the "remote" option, but there is no such option besides "share project" and "Apply Patch"), but it only shows the local clone of the Git repository, and if I tried to add the project to it it tells me that "cannot move project to target location as location overlaps..." So now I am stuck and not sure what to do, can anyone help me find the right direction?
Thanks in advance.

How do I add an Eclipse java project with EGit to Github?

I have created a repository on Github and have the project in my Eclipse. I also have the Egit plugin and Github plugin. I've looked all over the internet for help on this, but I at last must turn to the Stack Overflow community.
How do I add my java project from eclipse into my repo on Github?
There are a few tutorials out here on how to import projects from git into eclipse.
Though, you can follow these steps:-
Choose the "Git" Perspective, from Window->Perspective->Open Perspective->Other, and then search for Git and select it. This opens the Git repositories view.
From the "Git Repositories" view , choose the option which says "Clone a git repository and add the clone to this view."
Follow the wizard, enter all the details.
Choose the branches you want to import.
Choose the local directory, select clone the sub-modules.
You can choose to import all existing projects by checking the box against "Import all existing eclipse projects", now or you can selectively import projects later. Hit finish.
The git repositories view will now show your repository.
Now you will need to import projects from this repository, only if you havent selected the "Import all existing eclipse projects" box before.
Right click on your repository from the Git Repositories view. Select "Import Projects" option.
Check the radio option, "Import existing Eclipse projects", select the project from your working directory. Click next and then hit Finish.
The Project Explorer should now be showing your project listed there and the name of the branch in square brackets.
Make changes, add files, edit files, once you are ready to make your first commit. Right click on your project under Project Explorer, select Team->Pull.
If this is your first commit, it will say Nothing to update - everything up to date. Hit Ok. Otherwise, it will download the changes, if there are merge conflicts , it will show you those. There are other tutorials which will guide you through dealing with merge conflicts.
Right Click again on your project, select Team->Commit.
This opens a Commit Changes window, leave a meaningful commit message.
Select Commit and push.It should ask you for your username and password, you can check the box, which says store these.
Should show Pushed to origin with Message Details. Hit ok, and you are done with your first commit.
Select a project. Right click, Team->Share. Select the Git provider. Follow the wizard.

How to properly use EGit with Eclipse

The only way I seem to be able to get use git in eclipse is to create a non-git project then turn that into a repository. This ends up moving the project out of the eclipse workspace on the file system. I then have to delete the project(it's still in the git repository), then import a git repository after creating a branch and clone it to get it back into the eclipse workspace.
Is there a simpler way?
I simply want to create project that is really a clone from a local repository. Essentially I have two copies on my HD but I can commit the eclipse project to the git repository. Unfortunately there has to be a better way?
To answer this question involves three steps.
Create a external (remote) repository
Share the project in a way that it remains in the workspace
Connect the project repository to the remote repository
Create a Remote Repository on Your Local Machine
Switch to the Git perspective. Click on Create a new Git Repository.
When a dialog appears select a directory where you would like your remote
repository to be. This is were your project will be pushed to. You will also
want to select the Create as a bare repository option.
That's it for this step. You should now have this repository in your EGit
repositories list.
Sharing Project within the Workspace
There are two ways to share a project so that it remains in your workspace.
1. Make the project directory a repository
2. Make the whole workspace directory a repository
The Project as a Repository
The first option option is not recommended by the Eclipse team. This issue is
described in more detail at Why is not recommended to have an Eclipse project folder as a Git repository?.
The basics of the issue are twofold:
You can't have more than one project per repository
If some thing happens to your workspace you'll lose your repository too
Issue 1 isn't solved here. Issue 2 can be solved by connecting to a remote
repository as show later.
To share the project as a repository:
Right click on the project
Select Team -> Share Project... from the popup menu
Click Use or create repository in parent folder of project
Select the project from the list
Click on the Create Repository button
Click the Finish button
Next you'll want to connect your newly created repository to the remote repository.
That's covered below.
The Workspace as Repository
The second options allows multiple projects to be added to your repository.
In fact any new project you create will automatically added to the repository.
Automatically adding projects can cause some issues.
One issue is that, if there are changes in multiple projects, staging
those changes can take a bit of wading through. Using a Tree presentation when
staging can simplify things.
Another more serious issue occurs when importing a git clone of a project into
the workspace. This importing will create nested repositories. Nested
repositories can cause problems
according to this post.
By default Eclipse doesn't import the git clone of the project into the workspace.
To share the workspace as a repository:
Right click on the project
Select Team -> Share Project... from the popup menu
Click on the Create button
Select your workspace as your Repository directory
Click the Finish button
Once your repository is created you may want to do a little house keeping. I suggest
adding the RemoteSystemsTempFiles project to the .gitignore file. Note: the
.metadata file is added automatically by Eclipse.
You can ignore the RemoteSystemsTempFiles by:
Switching to the EGit perspecitive
Selecting the workspace repository from the list of repositories
Select the Git Staging tab
Click on the View Menu button on the right side the the tabs toolbar
Select Presentation -> Tree menu (folders are easier to ignore form the tree view)
Right click on the RemoteSystemsTempFiles project
Select the Ignore Folder menu
Ignore other projects in the same way
Connecting to the Remote Repository
The last stage is connecting the workspace repository to the remote repository
we created earlier. Once you've switched to the EGit perspective:
Expand your workspace respository
Right click on the Remote node in the tree
Select the Create remote... menu
Leave the remote name as origin
Select Configure fetch
Press Ok
Click on the Change... button
Click on the Local File button
Select the bare repository that you created in the first section
Click Finish
Click Save and Fetch and then Ok
You can then stage, commit and push changes in your projects and workspace.
When you first commit and push EGit will push the default branch master
to the remote and configure pulling this branch from remote repository.
Follwing the User Guide, you would need to create the .git repo within your current project path:
If the .git path is within the current project path, there is no reason EGit moves your files anywhere else.

Eclipse Egit Not Detecting Changed Files

I have been using Egit and Eclipse together for well over a year. I recently upgraded my computer and had to reinstall everything. Previously whenever I would make a change to a file it would immediately get picked up by Egit and show with the red highlight and star next to the file name in the project explorer.
I have everything back up and running exactly as it was, however whenever I make a change the change is not picked up by Egit. I have to perform a 'git status' in order for the files to show as ready to be staged in the file explorer. Am I doing something wrong to have Egit automatically detect changed files and has anyone else had this problem?
which version of EGit are you using
do you get the egit team menu if you right-click any resource in your git tracked project ?
if not then you need to do "Team > Share > Git", then check "Use or create repository in
parent folder of project". If you are using a very recent nightly build version this
will be checked automatically.
when you modify a file tracked by (e)git a text decorator ">" should
appear in front of the modified file
as soon as you stage the modified file (Team > Add) the decorator should show the star
also the staging view should always show the git status for all modified files
You need to "Add to index" all files again probably
Track Changes Click Team > Add on the project node. (This menu item
may read Add to Index on recent versions of Egit)
(From the EGit docs:)
What I've found is that you need to make sure that your git repositories are showing up in the Eclipse Git Repositories view.
In the repositories view, you click on the [very] little Git icon with a green + (plus) sign to Add and Existing Local Git Repository.
Browse to the directory that already has a .git subdir and click Finish. You should then see you local repo show up in that list.
Then you can right click on the repo while still in the repositories view and add pull down to Import Projects.
"Import existing projects" is selected. Click Next.
Your project should be checked off. Add it to a working set if necessary. Click Next (maybe Finish).
I had a similar issue where all my changes just disappeared. Somehow, Eclipse had unselected my Git repository. Once I selected it again, they all came back.
If you have already added your files to Stage then change the branch it will ask you to commit/stash/reset
I faced the same problem. From your git repository view: Right-click -> Show in git staging
For me I have clicked Team --> Advanced --> No Assume Unchanged, fixed the issue
I faced the same problem using eclipse version 2021.12. Whenever I made changes on file, the eclipse didn't detect it.
I solve it by using Intelij IDE.
i just faced this problem by now, and i resolved by clicking in button Refresh in Git Staging: