Remove git repository from Eclipse - eclipse

I added a git repository to my project and then I hit Team > Disconnect. How do I remove this repository completely? I'm trying to set up a new git repository on my project, but I keep getting an error message.

In Eclipse go to Window > Show View -> Other... Then select Git > Git Repositories. A view with all your Git repositories should now be visible. Right-click on the repository you want to remove and select Delete repository.
Eclipse will now ask for a confirmation and give you the option to remove all repository data.
In Eclipse Neon you can also delete a repository by hand (via the OS). In that case the repository will simply disappear in the Eclipse Git Repositories view. This is not recommended for older Eclipse versions!

If you just want to remove the repository from the Eclipse but not want to delete the data from your computer, follow these steps :
First switch to Git perspective (Window - > Open Perspective -> Other -> Search for Git)
In the Git Repositories section, right click your repository and select Remove Repository from View. This will prompt you to confirm if you want to remove the projects that are imported in Eclipse from this repository. Click Yes and you are done.

Related

How to move Eclipse project from one Github repo to another?

I am new to github. I cloned my github repo to eclipse using EGit.
Now, I have two repo in my Eclipse.
I added my Java Eclipse project to the old repo. I would like to added my Java Eclipse project to new repo. How could I move my Eclipse project from one repo to another?
From eclipse, you can right click on a project and select the Team > Disconnect menu option to disassociate the project with the old git repository. Then right click the project again and select the Team > Share Project option. From the 'Configure Git Repository' dialog, you may need to uncheck the "Use or create repository in parent folder of project" check box. You will then be able to select the location of the git repository you want to associate with the project.

Eclipse Egit Project Explorer Changes

I'm having an issue with Eclipse and git tracking changes. Eclipse doesn't show any changes unless I disconnect from git and reconnect.
File Structure
ProjectA
src
backup.c
compare.c
So let's say I make a change to backup.c. I expect Eclipse to add the > symbol to indicate changes. This doesn't happen.
Refreshing the project does nothing.
Right-click backup.c > Compare With > HEAD Revision shows the changes.
On command line git status shows the backup.c as modified.
In order to try to fix this I tried to remove the project from Eclipse and then deleting the .project folder before creating a new project. No difference.
The following works and will add the > to indicate changes, however, it only refreshes once. If I make further changes to compare.c it does not show up and I again have to repeat the steps.
Right-click project > Team > Disconnect
Right-click project > Team > Share Project > Git
I'm out of ideas. How can I get Eclipse and git to work together? I'm running the latest version of Eclipse and Egit
edit 1
One thing I forgot to mention is the Synchronize view in Eclipe does show the changes. So Eclipse can see the change, it just doesn't mark it properly in Project Explorer.
Text Decorations for Git (edit 2)
Files: {dirty:>} {name}
Folders: {dirty:>} {name}
Projects: {dirty:>} {name} [{repository }{branch}{ branch_status}]
Submodules: {dirty:>} {name} [{branch}{ branch_status}]{ short_message}

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.

Why are there different types of "Team" menus with EGit?

What dictates which type of team menu shows up for my project? Is there a way to switch between the two?
very traditional git-ish (ie. without "Synchorize Workspace" option)
eclipse team-ish (eg. with "Synchroize Workspace" option)
Update
My git repositories view shows the following:
Using the following steps I have enabled the "Team" features for my project:
delete project in Eclipse
delete project on filesystem (including .git/ repository data)
clone project into filesystem
add local repo to "Git Repositories" Eclipse view
in Eclipse, invoke an "Import Projects..." on the newly added repository, and "Import as general project"
The second menu should be in effect when you have:
Configured Upstream fetch
Configured Push to Upstream
That is when your local repo knows what to fetch from or push to your remote repo.