alex
alex

Reputation: 11410

"Invalid remote: origin" error when importing to Eclipse (m2eclipse, eGit)

In Eclipse when I try to import a project from a repository (File > Import > Maven > Check out Maven Projects from SCM) I select 'git' (eGit installed), fill in the ssh://... address (all the keys and access permissions are set), finally type in the password for rsa and...

Invalid remote: origin: Invalid remote: origin

According to this: http://youtrack.jetbrains.com/issue/IDEA-77239 writing .git at the end of address should solve the problem but actually it does not.

I have totally no idea how to resolve it further. Any ideas?

Edit: And I use Windows. It seems like an important piece of information to add.

Upvotes: 13

Views: 43612

Answers (5)

Martin Haeberli
Martin Haeberli

Reputation: 304

Using Eclipse / Indigo, with the Maven plugin:

  • Check out Maven Projects from SCM

  • assuming that the git SCM plugin is installed, select "git" from the SCM URL: popup

  • enter, e.g.:

    https://<username>@github.com/<username>/<projectname>.git
    

    having @ and ".git" is important

  • assuming that the project is private, you will be prompted for the password

This should be good enough to move forward.

Upvotes: 2

shashi009
shashi009

Reputation: 787

This Error may occur due to following reasons -

  1. Check the repository url, there should be a '.git' appended in the end.
  2. In case your network configurations have changed, make sure you have correct proxy configuration, and in case of secured git repository, make sure you provide correct credentials. (I got this error when my credentials were changed, and also when i had incorrect proxy configured.)

PS - To check network settings, go to Windows -> Preferences -> General -> Network Connections. Also if you're unsure of network settings or proxy config, you can try switching between Direct and Manual network settings.

Upvotes: 0

Venkatesh Laguduva
Venkatesh Laguduva

Reputation: 14408

May be your git server has moved?

enter image description here

Upvotes: 1

Reece Markowsky
Reece Markowsky

Reputation: 123

check out your .git/config this error can occur is your missing ".git" at the end of your origin url

[remote "origin"] url = https://some.domain.com/repo/name

should be

[remote "origin"] url = https://some.domain.com/repo/name.git

Upvotes: 0

Adam Keck
Adam Keck

Reputation: 186

This error can occur when there is an underlying SSH authentication issue, like having the wrong public key on the git remote server or if the git remote server changed its SSH host key.

Eclipse will use the .ssh directory you specify in Preferences -> General -> Network Connections -> SSH2 for its ssh configuration. Set it "{your default user directory}.ssh\" .

To fix things, first you need to determine which ssh client you are using for Git. This is stored in the GIT_SSH environmental variable. Right-click on "Computer" (Windows 7), then choose Properties -> Advanced System Settings -> Environment Variables.

If GIT_SSH contains a path to plink.exe, you are using the PuTTY stack.

  • To get your public key, open PuTTYgen.exe and then load your private key file (*.ppk). The listed public key should match the public key on the git remote server.
  • To get the new host key, open a new PuTTY.exe session, and then connect to git@{git repo host}.
  • Click OK and say yes to store the new key.
  • Once you get a login prompt, you can close the PuTTY window. The new key has been stored.
  • Restart Eclipse.

If GIT_SSH contains a path to "ssh.exe" in your "Git for Windows" tree, you are using Git for Windows's OpenSSH.

  • Set %HOME% to your default user directory (as listed in Eclipse; see above).
  • Set %HOMEDRIVE% to the drive letter of your default user directory.
  • Set %HOMEPATH% to the path to your default user directory on %HOMEDRIVE%
  • To get your public key, open the file %HOMEDRIVE%%HOMEPATH%/.ssh/id_rsa.pub (or id_dsa.pub) in a text editor. The listed public key should match the public key on the git remote server.
  • To get the new host key, run: cmd.exe
  • Run Git Bash
  • Ctrl-C
  • At the bash prompt, run /c/path/to/git/for/windows/bin/ssh.exe git@{git remote host}.
  • Type yes to accept the new key.
  • Once you have a login prompt, type: ctrl-c
  • Close the cmd.exe window
  • Restart Eclipse.

Finally, if you are still having trouble with your external ssh client, delete the GIT_SSH environmental variable and set the HOME environmental variable to your default user directory on Windows. Without the GIT_SSH variable, EGit will use its internal ssh client (java). It will use the .ssh directory you specified above as its SSH configuration directory.

Note: If you have Git for Windows, you can use its tools to create a SSH key pair your .ssh directory:

  • Set %HOME% to your default user directory (as listed in Eclipse).
  • Set %HOMEDRIVE% to the drive letter of your default user directory.
  • Set %HOMEPATH% to the path to your default user directory on %HOMEDRIVE%
  • Run Git Bash
  • Ctrl -C
  • Run: ssh-keygen.exe -t rsa -b 2048
  • Save to the default filenames
  • Choose a passphrase or save without one. If you save with a passphrase, Eclipse will prompt you for it each time you push or pull from your git remote server.
  • Close Git Bash

You can also use the GUI in the SSH2 Preference pane in Eclipse to manage hosts and keys.

Upvotes: 12

Related Questions