Eclipse Git (egit) pull and push to upstream option not available some times.? - eclipse

Right click on Project -> Team -> push and pull not available(EGIT)
Eclipse pull and push to upstream option not available some times.?
i am able to see commit every time but push ,pull,remote are missing some times
How to make appear them always

Basically your eclipse is disconnected with git.
Right click on project -> Team -> share Project -> Select Repository type as git -> Next -> chose your project and finish.

For me this disappeared as well, while the .git/config is unchanged and good.
Refresh did not help.
But Eclipse restart did the trick.

The options disappear sometime if the EGIT is not able to find the path from which it should Fetch, Pull and Push.
Check if the origin is deleted.
Goto the GIT Repositories View
See for the Remotes -> origin
If the Push and Pull in origin are deleted. You will have to add the URI by right click on the origin, add origin and configuring the Push and Fetch URI.
I hope this will be helpful.

Yes, this is a frequent annoyance. If Refresh doesn't work, I use "Close Project" followed by opening it again.

Related

Gitlab : fetching works but not pushing

I forked a project and fetch from amain project, but when i try to push into a my forked project i get
"can't connect to any repository..."
-I use Egit in eclipse-
the location of the destination repository, is defenetly right, because in the next step I can chose the target ref Name and there I can chose my branch.
Did i miss any read and write permissions or whats wrong there?
Goto the GIT Repositories View(Window -> Show View -> Others->(in the text filter) GIT Repositories ).
Check the Remotes -> Origin
If this Push and Fetch are missing
Right click on the Remote -> Add origin and configure
Check for the .gitignore file in your working directory which might sometimes help my friend.

Eclipse EGit Checkout conflict with files: - EGit doesn't want to continue

I've started Eclipse EGit. In some scenarios it is really not comprehensive.
I have local file e.g. pom.xml changed. On git server this file was changed.
I do pull, EGIt says:
Checkout conflict with files:
i.e. pulling stops (fetch is done, but not merge), that is OK. However the next is bad experience.
I synchronize workspace, put my changes aside and make it the same as FETCH_HEAD. But EGit doesn't want to continue. I replace the file with HEAD revision. But EGit still doesn't want to continue.
What standard expected user operation should be with EGit after conflict resolution?
UPDATE:
I added to index, then marked as Merged -> pull still can't pass.
When I select Merge I get the dialog
I can't commit the file as it is not in list of changed files.
Situation:
You have local uncommitted changes
You pull from the master repo
You get the error "Checkout conflict with files: xy"
Solution:
Stage and commit (at least) the files xy
Pull again
If automerge is possible, everything is ok.
If not, the pull merges the files and inserts the merge-conflict markers (<<<<<<, >>>>)
Manually edit the conflicting files
Commit and push
This is the way I solved my problem:
Right click the folder that has uncommitted changes on your local
Click Team > Advanced > Assume Unchanged
Pull from master.
UPDATE:
As Hugo Zuleta rightly pointed out, you should be careful while applying this. He says that it might end up saying the branch is up to date, but the changes aren't shown, resulting in desync from the branch.
After closing the Conflict Error Dialog; from the Project Explorer, right click on the head of the project -> Team -> Stashes -> Stash Changes
Enter a name for your stash. E.G. "Conflict"
Try Pulling again. Hopefully there are no errors this time.
From the Git Repository view, expand your repository -> Stashed Commits
Right Click on the stash you created in step 2 -> Apply Stashed Changes
This brings up the merge tool if it can't automatically merge it.
Manually resolve the merge conflicts in the file/s.
Right Click on the file editor -> Team -> Add To Index
If you are not ready to commit the file or just don't want it in the Index, right click on the file editor -> Team -> Remove from Index.
Cleanup: From the Git Repository view, right Click on the stash you created in step 2 -> Delete Stashed Commit
Your local working directory file should be be merged
If error comes for ".settings/language.settings.xml" or any such file you don't need to git.
Team -> Commit -> Staged filelist, check if unwanted file exists, ->
Right click on each-> remove from index.
From UnStaged filelist, check if unwanted file exists, -> Right click on each->
Ignore.
Now if Staged file list empty, and Unstaged file list all files are marked as Ignored. You can pull. Otherwise, follow other answers.
I guess the best way to do this is like this :
Store all your changes in a separate branch.
Then do a hard reset on the local master.
Then merge back your changes from the locally created branch
Then commit and push your changes.
That how I resolve mine, whenever it happens.
After you get from Eclipse the ugly CheckoutConflictException, the Eclipse-Merge Tool button is disabled.
Git need alle your files added to the Index for enable Merging.
So, to merge your Changes and commit them you need to add your files first to the index "Add to Index" and "Commit" them without "Push". Then you should see one pending pull and one pending push request in Eclipse. You see that in one up arrow and one down arrow.
If all conflict Files are in the commit, you can "pull" again. Then you will see something like:
\< < < < < < < HEAD
Server Version
\=======
Local Version
> > > > > > > branch 'master' of ....git
Then you either change it by the Merge-Tool, which is now enable or just do the merge by hand direct in the file. In the last step, you have to add the modified files again to the index and "Commit and Push" them.
Checking done!
The proper solution is the one provided by #Jojo.Lechelt.
However if you don't want to commit for any reason and still want to pull the changes,you may save your changes somewhere else,replace the conflicting file with HEAD revision and then pull.
Later you can paste your changes again and compare it with HEAD and incorporate other people changes into your file.
Right click on the project and select [replace with] -> Head Revision .Now select pull changes in current branch or pull changes from upstream.
In Eclipse :-
Right click -> click on 'add to index'
Add conflict file in staged area
Right Click ->click on commit
Add conflict file in local repository
Pull
You will get all changes (change in remote repository and local repository)
Changes mentioned as Head(<<<<<< HEAD) is your change, Changes mentioned in branch(>>>>>>> branch) is other person change, you can update file accordingly.
Right click ->click on add to index
Right click -> commit and push
I have completely different experience with this problem.
when I pulled (my staging are were clean!), I saw lot of files in staging after pull, which I didn't changed or added, So I cleaned staging area again by replace with head. After trying pull again I faced same problem again, now this time I did following:
stashed changes
Close any file open in another program from your repository
Try pulling
Hope this solve your issue.
Thanks

EGIT rejected non-fast forward

I'm on Eclipse 4.2.1 (Java) and trying to use EGIT. My account is all set up on Github. No one else is working on it so there are no changes. I have a very simply project containing a single file with one print statement.
I created my local repo and added the project. (project explorer shows: [gitrepo1 master])
In project explorer:
right click on project -> team -> remote -> push
But I get: master: HEAD [rejected - non-fast-forward]
I've configured the push:
Branch -> master
URI -> ssh.git#github....
Ref mappings -> HEAD:/refs/heads/master
What am I doing wrong?
We had this problem, because we amended a commit after pushing it.
The solution was to merge origin/master (in Branches > Remote tracking), then push.
egit works by using jgit which is an implementation of git that is using java. the best thing to do is verify that the repo works with the normal git client. From your question it is not possible to know exactly how things ore configured.
When you get the error message that you could not do a push because it is not a fast forward, it means you need to do a pull first then, do the push, so try that.
Same cause as Bernát: I amended a commit after pushing it. Merge failed because of conflicts.
My way out: Context menu 'Team/Reset' selection 'Remote Tracking'/'origin master' option 'Mixed'. After that all my changes since last push were marked and I could commit and push.

Eclipse/Egit, Push to Remote menu choice is grayed out

I created a repository on GitHub. I set up a local git repository using Eclipse and Egit.
With Team > Remote > Push. I managed to push the local repo to the one on GitHub.
Now I expected to be able to use the Team > Push to Upstream (as well as fetch from upstream) as a one-click push (and pull/fetch), but this menu choice is not available (grayed out). I have to use Team > Remote > Push to each time manually fill in the info (ctrl+space helps).
Following this, I created a remote configuration and pushed from the repositories view, and I can see the remote GitHub repository listed under Remotes but still the Team > Push to Upstream command is grayed out in the menu.
Could someone please give me a hint as to what I have may done wrong?
Here's what I did and this worked fine:
Right click your project, choose Team→Show in Repositories View. You will switch perspectives and be in the Git Repositories tab.
Right-click "Remotes" and choose "Create Remote". For "Remote name", enter "origin". Click OK.
Click Change. Enter your information as you did during your initial push. Click Save.
You should now be able to push by merely right-clicking on your project, then Team→Push to Upstream.
Because the remote was added under the project in question, each project can have its own upstream origin and they will not interfere (whereas the Window > Preferences solution is a global setting).
Based on your description of what you did, it appears you attempted this - but possibly did not use the name "origin" for the remote, which is absolutely necessary. I stumbled across this solution by pure chance.
I had this problem and thankfully found a way to re-enable the "Push to Upstream" option.
Go to Window > Preferences > Team > Git > Configuration.
Select the Repository Settings tab and then the repository that represents your project.
Click "New Entry..."
The key is remote.origin.url
The value is the url you copy from github. It's usually offered predominantly on whichever site you register with.
Perhaps there is a neater way of achieving the same thing. Once I reached this far I stopped looking because it works now.
You need to have the following type of configuration in that repository's .git/config file:
[branch "master"]
remote = origin
The remote setting can be any of your remotes or just a value of .
You can edit the repository's config by selecting the Properties menu item from the context menu for the repository in the Git Repositories view.
I came here searching for solution to solve similar problem with bitbucket - although none of the two highest votes answer didn't work for me, it proved that I had option "Put branch...", when I tried to do this, it says "Non fast-forward", but when I successfully made "pull", I was able to push to upstream.
Maybe it will help someone :)
This post might be a little old, but I had the same issue with one of my repos the following information from this link worked for me: Adding a remote to an existing git repo
The part i want to highlight from that article is the following:
[branch "master"]
remote = origin
merge = refs/heads/master
When I made the change in the .git/config and refreshed eclipse the "push to upstream" link worked for me. Keep in mind, I am assuming that you have a remote configured in your Git perspective for your remote repository.
In my case all git commit/push operations are inactive. I fixed the issue by placing the repository folder under git directory.

How do I set up Eclipse/EGit with GitHub?

I've never used Git before and would like to learn.
I have a private repository with GitHub.
I've installed the EGit plugin for Eclipse.
I have a workspace where I do my work, generally: ~/Documents/workspace.
I am able to add my GitHub repository and download it, but in doing so it creates ~/MyRepository.
When I create a project, do I need to point it to ~/MyRepository?
Also, how come when I make an edit and I say push to upstream it says up to date?
Make sure your refs for pushing are correct. This tutorial is pretty great, right from the documentation:
http://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial
You can clone directly from GitHub, you choose where you clone that repository. And when you import that repository to Eclipse, you choose what refspec to push into upstream.
Click on the Git Repository workspace view, and make sure your remote refs are valid. Make sure you are pointing to the right local branch and pushing to the correct remote branch.
In Eclipse, go to Help -> Install New Software -> Add -> Name: any name like egit; Location: http://download.eclipse.org/egit/updates -> Okay. Now Search for egit in Work with and select all the check boxes and press Next till finish.
File -> Import -> search Git and select "Projects from Git" -> Clone URI.
In the URI, paste the HTTPS URL of the repository (the one with .git extension). -> Next ->It will show all the branches "Next" -> Local Destination "Next" -> "Import as a general project" -> Next till finish.
You can refer to this Youtube tutorial: https://www.youtube.com/watch?v=ptK9-CNms98
Install Mylyn connector for GitHub from this update site, it provides great integration: you can directly import your repositories using Import > Projects from Git > GitHub. You can set the default repository folder in Preferences > Git.