'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository
Might also be bad SSL cert, fix the server
If you have a GIT server with an outdated or self-signed SSL cert fix the server, afterwards everything should run fine.
Insecure Hotfix: Let the client accept any certificate
The following solution is just a mere hotfix on client side and should be avoided as it compromises security of your credentials and content. There is a detailed explanation for this in "How can I make git accept a self signed certificate?" which offers more complex and more secure solutions you can try out if the following works in general.
In my case it was Eclipse using a different storage for the git config as the command line does and thus not having the option
git config http.sslVerify false
set (which I set using command line for the repo for working with invalid/untrusted SSL cert).
Adding the option insides Eclipse immediately resolves the issue. To add the option
- open preferences via application menu Window => Preferences (or on OSX Eclipse => Settings).
- Navigate to Team => Git => Configuration
- click
Add entry...
, then puthttp.sslVerify
in the key box andfalse
in the value box.
Seems to be a valid solution for Eclipse 4.4 (Luna), 4.5.x (Mars) and 4.6.x (Neon) on different Operating systems.
It happens due to the following Reasons:
1) Firewall.
2) Network Issues.
3) Proxy Settings Mismatch
4) Connected through different Router - which is not authorized within the network.
5) Git Proxy Authentication Details
Finally I made it work thanks to the steps outlined in the Eclipse forum:
Set up the SSH key stuff
- Download and install mysys git according to the github instructions at http://help.github.com/win-git-installation/
- In C:/Users/you/ssh hide any existing keys (id_rsa and id_rsa.pub) in a subdirectory. If the ssh directory does not exist, create it. Of course, "you" is your username as the OS knows you.
- From the start menu, run Git-Bash command shell (a regular DOS command shell will not work).
- In the Git-Bash shell generate an rsa key based on your email (the one you registered at github): ssh-keygen -t rsa -C "[email protected]" and enter your pass phrase and confirm when asked.
- The previous step should have created C:/User/you/ssh/id_rsa.pub which you can now open in a text editor and copy. At github, go to account settings, SSH Keys, add a key and paste this in the key box.
- In Git-Bash again (notice the back-ticks in the next line):
eval `ssh-agent` ssh-add C:/User/you/ssh/id_rsa ssh [email protected]
Here is what you just did: You ran the ssh-agent which is needed by ssh-add. Then you used ssh-add to make note of the location of your key. Then you tried to ssh to GitHub. The response to this last command should be that you have successfully authenticated at GitHub but that you don't have shell access. This is just an authentication test. If the authentication was not successful, you'll have to sort that out. Try the verbose version:
ssh -v [email protected]
Assuming this worked....
In Eclipse, configure the remote push
- Window > Show View > Git > Git Repositories will add a repository explorer window.
- In the repository window, select the repository and expand and right-click Remotes and choose Create Remote.
- Copy the GitHub repository URI from the GitHub repository page and paste it in the URI box.
Select ssh as the protocol but then go back to the URI box and add "git+" at the beginning so it looks like this:
git+ssh://[email protected]/UserName/ProjectName.git
In the Repository Path box, remove the leading slash
- Hit Next and cross your fingers. If your get "auth fail", restart Eclipse and try step 5 again.
- When you get past the authentication, in the next dialog select "master" for source ref, click "Add all branches spec" and "Finish".
Instead of using SSH [email protected] I did it with SSH [email protected].
Now I can push and import without any problem.