Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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.

1 Answer

0 votes
by (62.9k points)

Set up the SSH key stuff

  1. Download and install mysys git according to the GitHub instructions at http://help.github.com/win-git-installation/

  2. 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.

  3. From the start menu, run Git-Bash command shell (a regular DOS command shell won't work).

  4. 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 passphrase and confirm when asked.

  5. The previous 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.

  6. 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 simply did: You ran the ssh-agent which is needed 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 [email protected]

When this works out,  try the following:

In Eclipse, configure the remote push

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

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

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

  4. 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

  5. In the Repository Path box, remove the leading slash

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

  7. 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 [email protected], try it with SSH [email protected].

Now you can push and import without any problem.

Browse Categories

...