Eclipse, Egit, Github: remove pushed project folder - eclipse

I have successfully created a git hub repository, a local master, committed the initial changes and pushed them to github.
Unfortunately the project folder from Eclipse ends up in the repository. For example:
<username>/<gitrepositoryname>/<eclipse project folder>/<project files & README>
when for most people it looks like:
<username>/<gitrepositoryname>/<project files & README>
I created a new local master after I found this tutorial Push eclipse project to GitHub with EGit
but now I am running into push problems such as "HEAD rejected - non-fast-forward" when using the new local master.
Can some please help me to correct this locally/remotely? Is there a way to switch local master branches so that I can sync the correct one with githib?
Thanks in advance.

It's pretty simple to fix:
Go to the "workspace" where you keep <eclipse project folder>
Make sure to delete the .git folder there
Tell git to force push the changes. (Checkbox) (It's usually not good to force git to do something, because you could loose commits/data BUT here, we really want to overwrite the old repository with the new one.)
Your changes should be up immediately. Next time you push, please make sure, the force push checkbox is disabled again

Related

Push to main instead of master from eclipse to git

I have been searching and I found git commands to change the repository but I'm new on github and I don't know how to make that from eclipse, everytime I push I make the changes on the master branch instead of the default main, when I try to push the main it says non fast forward and I can't do it, thanks.
Select Team > Advanced > Rename Branch
Rename local as main
Rename remote to main
when you first commit your project in eclipse and then you click on push
after filling the information of the repository you get this
you will write main here insted of master and your project will be pushed directly to the default main
my solution is only when you first upload your project to GitHub

How do I work on a branch in SVN Eclipse?

I've read multiple documentations already but I don't seem to get it - I want to branch one project folder of our rcp, change something there and test with the changes I've made there.
Which steps do I have to make to work on the branch? How do I integrate the branch in my workspace for testing without ruining my local files and what does Switch... do?
Working on a branch directly through Subclipse isn't possible. You have to check out to your local machine first and then commit back.
This will override local changes, so make sure to branch them first.
IF you want to test your quick changes in your project without your local changes ,this is what you can do
-Create a new branch of the trunk/active of your project in SVN
-Checkout the new branch from SVN as its own project
make your quick change . Test it locally
Check it back into the branch. When you are ready, merge your code.

Pulling a project from GitHub with EGit

I've setup a private GitHub account to make it easier for me to work on the same project on both my desktop and my laptop when I'm not at home. The project was originally on my laptop, so I configured EGit to push and commit to my private repo. That worked successfully, and now I can see my project when I log onto GitHub. I'm now trying to pull that project onto my desktop. I did the same configurations , and in the Git Repository View within Eclipse I can see Remotes->origin-> the Push/Fetch streams. I tried to fetch, and that placed an origin/master branch under git\branches\Remote Tracking. But I can't seem to do anything with it.
I'm not sure what to do next, or if I made a mistake somewhere?
Now just right click it and Create branch.... This will make a local branch that will track this remote branch. When you push Eclipse should automatically configure everything so that origin/master will get updated.
Check out the local branch to start working.
UPDATE:
To import the project from working copy select the following:
If you have checked in your configuration files (.project, .classpath etc) you will get a list of all available projects in the repo to import to workspace. If not you will need to import them manually.

Eclipse and EGit . Push?

I am using GIT as DVCS. I have a team working with me on a project.Last night when I committed changes to the repository. It caused lost of previous changes made by other developers.(I did this: 1)-Pulled the project from remote directory and then 2-)Commit and Push the files to remote repository. These are all the files that I had recently pulled from directory + my modified files) Can somebody please tell me the exact steps that I should follow to push and pull. And I should be able choose only files that are changed by me.
Thanks!
I forgot to mention that I did the "Force Update" while pushing to remote repository.

Am I using EGit and Eclipse correctly when working with repositories?

I'm trying to set up EGit with Eclipse and I've used neither of them before. I understand the basics around Git and Eclipse is more or less just another IDE. The problem I'm having is setting up a reasonable work environment.
I have file-server at home which I want to use as a Bare repository which I push and pull changes to. To test it out I've done the setup locally.
I have a bare repository created through the Git Repository perspective.
I've cloned that repository into a local non-bare repository.
I've created a project in a subdir of the non-bare repository (is this the way to go? Is it possible to do have the project directly in the workspace with the .git folder within it? So far I've had a lot of trouble with it when trying to create an Eclipse project out of it. What is the proper way to do it?)
I've made some changes to this cloned repository and added the indexes, committed the changes and attempted to push the changes to upstream.
The thing is that no changes are made to upstream. Would someone like to explain the procedure in doing the push so that I'm not misunderstanding something? Or am I completely wrong on utilizing a bare repository instead of just working non-bare?
As mentioned in this tutorial, you create your Git repo right where your project is (ie your .classpath and .project files are).
Pushing to a bare repo is a good idea (see the links mentioned in "Git - pull & push - production server")
You need though to specify what you want to push:
Click at least on "Add all branch spec".