Eclipse Egit not picking up configured remote repository - eclipse

I have since upgraded to Juno and the latest version of Egit. However, i noticed that when i attempt to push to a remote repository, the configured remote repository is defaulting to some random repository URL that isn't associated with my repository. the configured one seems to be picked up from some other location. has anyone seen this behavior? i checked my repository and see the proper remote URL present.

I guess you use on of those menus which invokes the Push Wizard. That one allows to push to arbitrary locations, independent of the current repository. Instead of doing this all the time, please configure an upstream configuration, so you can push to upstream without any location selection.
If you really work with multiple remotes and want to push to more than one repository regularly, then you should have each of those remotes configured with its specific push URL and specification. That way you can push to different remotes by just selection the push context menu on a remote (without any additional selection).

Related

Disable Gerrit for repository in Eclipse

I accidentally enabled Gerrit for one of my Git repositories when developing in Eclipse. Is there any way to disable this?
I'm primarily asking because it seems to have the side-effect of slowing down my staging processing within Eclipse for that repository ever since the enabling of Gerrit.
Update:
I couldn't find anything in the Git config for the repository that pointed to Gerrit or reviewing. So, I tried removing the repository and the projects associated with it from the workspace and then re-importing it, but that doesn't help either..
Turns out that Gerrit is configured through the existing remote configuration (e.g., origin) itself. There are specific push/fetch specs associated with Gerrit that are added by Eclipse. If you simple remove all the existing specs and add the ones you need (or just All Branches Spec) from both the push and fetch spects, then Gerrit is disabled again.
Thanks to #VonC for putting me on the right track!
Both "Eclipse Gerrit" and "EGit/Contributor Guide" mentions a remote named "review"
Check in command line if you can remove it:
cd /path/to/your/repo
git remote remove review

Using Eclipse and eGit - after the initial setup, how do I tell what protocol is being used, i.e. ssh or not?

We have a small team of developers working on a project that works with a Git repository hosted by TFS that is already owned by the customer. We are using Eclipse and eGit. How can I tell what protocol is being used when we do pull and push? I can see the URL but i'm not sure how to tell what the protocol is.. I'm interested in knowing if SSH is involved.
git remote get-url --all origin
will to display information about URLs of the remote. If they start with https then http is used. If they start with user#server.domain then, most likely, ssh is used.

No remote URL configured for current branch project

Why is eclipse giving me this "No remote URL configured for current branch project" error every 2 minutes? It is triggered when the Yatta application request a project export, I assume.
Triggered by the de.yatta.eclipse.launcher.oomph.tasks plugin:
org.eclipse.team.core.TeamException: No remote URL configured for current branch in repository of project vaadinwebsite.
at org.eclipse.egit.core.GitProjectSetCapability.asReference(GitProjectSetCapability.java:81)
at org.eclipse.egit.core.GitProjectSetCapability.asReference(GitProjectSetCapability.java:53)
at de.yatta.eclipse.launcher.oomph.tasks.impl.ProfilesProjectSetImportTaskImpl.getProjectReference(ProfilesProjectSetImportTaskImpl.java:289)
at de.yatta.eclipse.launcher.oomph.tasks.impl.ProfilesProjectSetImportTaskImpl.getProjectReference(ProfilesProjectSetImportTaskImpl.java:276)
at de.yatta.eclipse.launcher.oomph.setup.internal.builders.ProfilesProjectSetImportTaskBuilder.addProjectReference(ProfilesProjectSetImportTaskBuilder.java:149)
at de.yatta.eclipse.launcher.oomph.setup.internal.builders.ProfilesProjectSetImportTaskBuilder.build(ProfilesProjectSetImportTaskBuilder.java:133)
at de.yatta.eclipse.launcher.oomph.setup.builders.core.SetupBuilder.buildTasks(SetupBuilder.java:290)
at de.yatta.eclipse.launcher.oomph.setup.builders.core.SetupBuilder.buildTasks(SetupBuilder.java:233)
at de.yatta.eclipse.launcher.client.export.ProfileExporter.createProfile(ProfileExporter.java:521)
at de.yatta.eclipse.launcher.client.export.ProfileExporter.exportProfile(ProfileExporter.java:103)
at de.yatta.eclipse.launcher.client.export.ExportJob.run(ExportJob.java:82)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
To the best of my knowledge, there is a remote URL for this project. I mention "eclipse" and "yatta" only to give some context. Considering the comments, it is probably more a "git" setup problem.
Eclipse's error message says "for current branch" (emphasis mine), so presumably it's not willing to take a global repository-wide remote: it wants one specifically for the current branch. If there is only one remote, most likely named origin, presumably this means you should set the current branch's remote setting to origin. If the current branch is zorg that would, on a command line, be git config branch.zorg.remote origin. What commands to use, or clicky boxes to click on, in Eclipse, I cannot say.
This seems like a bug in Eclipse: Git in general will use origin when no remote is configured (e.g., if you run git fetch and the current branch has no configured remote, Git tries to fetch from origin). Since Eclipse is its own thing, it can of course make its own rules, disregarding Git's in little ways like this, or even in major ways.
(Copied from comment to answer, with a bit of editorializing added :-) )

How can I develop from more than one machine?

Is Clone the only way for me to get my own repository to a different machine?
I have published my repository from my home PC and am trying to edit it from another.
I'm using Github for Windows but cannot see how to get the published repository to a second machine in order to edit the code and republish the changes so I can later use on the original PC.
The general approach for Distributed Version Control Systems is to:
Clone the repository (from the server)
Update your code (local, in your working directory)
Commit the code (local, in your working directory)
Push the commits (to the server)
Pull the new commits (from the server) to another development PC.
Typical development cycles iterate between steps 2 and 3. And sometimes 4 (to store your changes off-site) and 5 (to grab changed made by others).
As I suppose that 'Github for Windows' uses git(hub), it is also a DVCS and works also with these steps.
The proper way to do this is to clone the repository onto your second machine, straight from the source (Github). Sharing one clone between multiple machines is not recommended except in a few circumstances.
Resolved.
I had to delete the local repository. Github then prompted me with an error and the option to "Clone again", this clone again worked.
Thanks.

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.