Cannot open git upload pack error in Eclipse when cloning or pushing git repository

5.6K    Asked by Yashraj in Devops , Asked on Nov 30, 2023

I am not able to clone or push to a git repository at Bitbucket in Eclipse:

Error 'cannot open git-upload-pack'

It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error keeps showing. Also I have installed SourceTree and it says 'This is not a valid source path / URL':

Error 'This is not a valid source path / URL' in sourcetree

If I use git commands to import the project, it works, but I wan't to use EGit for this task, since I am a newbie with git.

I don't know if this has to do with it, but in the same directory I have the android-adt-bundle. This one works pretty well, but the project lies on GitHub and not Bitbucket. Also, I'm working with another person and he is able to fetch and push data from and to the Bitbucket repository. I have read lots of posts but none of them have helped me out.

I'm using Windows 7 btw.

Answered by Isaac Ross

Incase, you cannot open git upload pack then, Set up the SSH key stuff

You should 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 doesn't exist, create it. Of course, "you" is your username because the OS is aware of you.

From the start menu, run Git-Bash command shell (a regular DOS command shell won't 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 "you@wherever.com" and enter your passphrase and confirm when asked.

The past step ought to have created C:/User/you/ssh/id_rsa.pub that you'll be able to now open in a text editor and copy. At GitHub, visit 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 git@github.com

Here is what you simply did: You ran the ssh-agent which is required by ssh-add. Then you used ssh-add to create a note of the path of your key. Then you tried to ssh to GitHub. The response to this last command ought to be that you just have successfully authenticated at GitHub however, that you simply do not have shell access. This is just an authentication test. If the authentication wasn't successful, you'll have to sort that out. Try the verbose version:

ssh -v git@github.com

When this works out, try the following:

In Eclipse, configure the remote push

Window > Show view > git > git Repositories will add a repository explorer window.

In the repository window, choose the repository and expand and right-click Remotes and select create Remote.

Copy the GitHub repository URI from the GitHub repository page and paste it within the URI box.

Select ssh as the protocol then again go back to the URI box and add "git+" at the start, so it's like this:git+ssh://git@github.com/UserName/ProjectName.git

In the Repository Path box, remove the leading slash

Hit Next and cross your fingers. If you get "auth fail", restart Eclipse and try step 5 again.

When you get past the authentication, within the next dialogue choose "master" for source ref, click "Add all branches spec" and "Finish".

Instead of using SSH git@github.com, try it with SSH git@bitbucket.org.

Now you can push and import without any problem.



Your Answer

Interviews

Parent Categories