EmilioSG
EmilioSG

Reputation: 380

Can't push using EGit and Bitbucket

I've been trying to start a project using EGit with Bitbucket but I can't push the project to the repository in the server.

These are the steps I've followed (I'll try to be very specific so other people can use it as a tutorial mode; even though it's not working for me it might work for others):

1) I installed Git on Ubuntu 12.10 using this tutorial

2) Followed this tutorial for GitHub.

Everything is done. However, when I press "Push" I get the following error:

ssh://[email protected]/myuser/myrepository.git: push not permitted

I've tried every configuration possible: switched to a new work space, updated Eclipse, created new repositories, re-installed Git... Any ideas?

Upvotes: 11

Views: 17316

Answers (6)

dexter
dexter

Reputation: 758

Using Bitbucket I do it this way:

  1. create a repository in bitbucket
  2. clone the empty repository using the https url
  3. connect the project in eclipse to the repository using the Team -> Share option and select the location where you cloned the repo
  4. index (stage) your project files
  5. commit and push

Upvotes: 0

Greg Dubicki
Greg Dubicki

Reputation: 6930

In this specific case I agree with resolution from Olivier J.'s comment under original question.

But I have had similar problem and it was caused by something else. I resolved it and here is what happened:

  1. I have been using some private repository at Bitbucket (A) with some user account and some public key (X) to access it. I have had key X loaded in my pageant Putty key chain.

  2. Then I created a new public repository (B), also at Bitbucket with a different user account and another public key (Y). I added this key to pageant too.

  3. When I tried to access repository B apparently public key X and not Y was used, because ..for SSH client both connections are the same - same user (git) at the same host (bitbucket.org)! And key X was used first because ..it was loaded earier? Or maybe because its name was alphabetically first? I am not sure but the result was that...

  4. Read-only access for B using X was granted because the repository was public and any valid Bitbucket user key was enough to gain this kind of access!

  5. ..but writing (pushing) required key Y, which was not used by SSH.

So the general tip is: to resolve strange read-only git via SSH access errors check carefully which private key is actually used by SSH.

I resolved this problem by loading only one key - X or Y - in pageant at a time but I would love to do it a smarter way - please let me know in comments if you know how!

Upvotes: 0

chrizzler
chrizzler

Reputation: 84

Probably related, I fixed "auth fail" problems by following the instructions on: http://wangpidong.blogspot.com.es/2012/05/how-to-use-bitbucket-with-egit-in.html

Got it from: Configuring egit with BitBucket

Upvotes: 0

EmilioSG
EmilioSG

Reputation: 380

Alright, I've finally found a way to work with it.

It's just changing the authentication mode. If the HTTPS link is used, instead of using the SSH link, everything works perfectly. It seems that SSH works just in a read-only mode.

SSH/HTTPS selection

Of course the authentication method is different: you have to type the password and the SSH keys stored in Bitbucket are no longer necessary.

For those who are having problems with EGit, I recommend following eugener's way to automatically configure EGit. Then you just have to select HTTPS as authentication mode to push the stored commits.

Upvotes: 11

Eugene Ryzhikov
Eugene Ryzhikov

Reputation: 17359

There is much simpler way of configuring remote Git repos in Eclipse:

  1. Create an empty repo on BitBicket
  2. Copy repo's URL
  3. Clone repo to your machine using "Git Repositories" view.
  4. Share your project into newly cloned repo.

Since a repo was cloned - remote settings were configured automatically. This means you will be able to push immediately

Upvotes: 3

Mark Leighton Fisher
Mark Leighton Fisher

Reputation: 5693

It might be a user name misconfiguration in .gitconfig.

Upvotes: 0

Related Questions