40

I have repository on both github.com and bitbucket.org, and I am very familiar using Git Extensions for all repository functions... But when I started using bitbucket.org repositories I have to use TortoiseHg SVN for it ... so I want to ask that is there a way I can use Git Extensions for Bitbucket repositories?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Safran Ali
  • 4,477
  • 9
  • 40
  • 57
  • What do you mean by "TortoiseHg SVN"? There is [TortoiseHg](https://en.wikipedia.org/wiki/TortoiseHg) and [TortoiseSVN](http://en.wikipedia.org/wiki/TortoiseSVN). – Peter Mortensen Jun 26 '18 at 18:37
  • Note: GitExtensions's bitbucket plugin does not support bitbucket.org, which is most confusing. Make sure to only use the standard functionalities and not the plugin which will only return "Your repository is not hosted in BitBucket Server." (sic) – RedGlyph Apr 28 '19 at 12:47

3 Answers3

94

I haven't fully tested it, but these steps allowed me to clone a Bitbucket repository in Git Extensions.

You can use PuTTY to generate a public/private SSH key, then add that key to Bitbucket.

  1. Run GitExtensions\PuTTY\puttygen.exe

  2. Click Generate

  3. Click Save public key (as a text file)

  4. Click Save private key (as a ppk file)

  5. Run GitExtensions\PuTTY\pageant.exe C:\path\to\ppk-file.ppk

  6. Log into Bitbucket

  7. Go into Account settings (SettingsSecurity → SSH keys*)

  8. Paste your public key into the SSH keys text input as (spaces are important, do not include square brackets around the public key):

    ssh-rsa [AA-YOUR-PUBLIC-KEY-ALL-ONE-LINE-SPACES-REMOVED-==] youremail@domain.example

  9. Click Add key

  10. In Git Extensions, click Clone repository

  11. Use the SSH repository link on Bitbucket as the repository to clone

  12. Click Load SSH key

  13. Browse to and load the ppk file

  14. Click Clone

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
ryanttb
  • 1,278
  • 13
  • 20
  • 3
    I come to this comment each and every time I set up new accounts to work with GitExtensions and BitBucket. I've already upvoted you, but I feel a proper thanks is in order. Thanks so much! – DTI-Matt Mar 29 '13 at 14:45
  • I second @DTI-Matt's sentiment. I just need to remember to come back here everytime I have to go through this process. – Nick Pickering Jul 10 '13 at 05:21
  • 4
    It should be noted that the '[' and ']' characters surrounding the public key should not be included in what you pass to bitbucket. – Nick Pickering Jul 23 '13 at 03:56
  • If you don't see the "Load key" button when cloning the repository, make sure PuTTY is your default SSH client in the Git Extensions preferences. – Arboreal Shark May 22 '14 at 11:40
  • Thanks all! I updated step 8 to clarify that the brackets are not allowed. I'm leaving them because they make the required spaces easier to see. – ryanttb Jul 08 '16 at 17:00
  • Ad 7 - it is not Account settings but Personal settings in the user menu in the top right corner (not sure whether this has changed since the answer was posted, but confused me for a moment). – Vočko Mar 11 '22 at 02:29
14

I found that most of this worked for me with just a few small changes.

  1. Run GitExtensions\PuTTY\puttygen.exe
  2. Click Generate
  3. Click Save public key (as a text file)
  4. Click Save private key (as a ppk file)
  5. Didn't have to run this step --Run GitExtensions\PuTTY\pageant.exe C:\path\to\ppk-file.ppk--
  6. Log into bitbucket
  7. Go into Account settings
  8. Paste your public key into the SSH keys text input as (spaces are important but with no email address on the end): ssh-rsa [AA-YOUR-PUBLIC-KEY-ALL-ONE-LINE-SPACES-REMOVED-==]
  9. Click Add key
  10. In Git Extensions, click Clone repository
  11. Use the SSH repository link on bitbucket as the Repository to clone ( i.e. git@bitbucket.org:yourname/repo.git)
  12. Click Load SSH key
  13. Browse to and load the ppk file
  14. Click Clone

Also I found that I was having a problem saying that the machine I was looking for might not be the correct one. I found this very helpful and if you are having problems might be useful Using the SSH protocol with Bitbucket and very quickly helped me through that.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Chadwick13
  • 357
  • 1
  • 7
  • 15
  • 3
    A couple of points to clarify these instructions: 1) In puttygen select SSH-2 RSA rather than SSH-1; 2) You can copy the public key directly from the puttygen dialog **Public key for pasting into OpenSSH authorized_keys file** field into the BitBucket Add key textbox. Select everything up to the space before the key comment (which is tacked to the end of the field). I added the email address but didn't need the square brackets in the Add key textbox. – Simon Elms Feb 06 '13 at 06:08
  • Found the following very useful: [How to install a public key on your Bitbucket account](https://confluence.atlassian.com/display/BITBUCKET/How+to+install+a+public+key+on+your+Bitbucket+account) . Includes instructions for using puttygen and _very_ useful screenshots. – Simon Elms Feb 06 '13 at 06:10
  • Further to my comment above about copying from the puttygen dialog, all you need to do is copy the entire contents of the **Public key for pasting into OpenSSH authorized_keys file** field. Copy everything in that field, including the key comment at the end, and paste it into the appropriate field in Bitbucket with editing it or adding to it in any way. Simple. – Simon Elms Mar 10 '13 at 10:35
  • The link "How to install a public key on your Bitbucket account" in Simon's post above has changed slightly. This is [the updated one](https://confluence.atlassian.com/bitbucket/how-to-install-a-public-key-on-your-bitbucket-cloud-account-276628835.html). – rossmcm Nov 04 '15 at 03:38
  • I've copy the key directly form git extensions so instead of of txr file – marcel Jan 17 '16 at 11:52
3

It's been 10 years since the original answer was posted, and I can now get this working without using SSH:

  1. Log into Bitbucket, click on your avatar, and go to "Personal settings".
  2. Go to "App passwords", and click the "Create app password" button.
  3. Create a password for Git Extensions. When selecting permissions, choose "Read" and "Write" under "Repositories". You will be shown the password only once - make a note of it.
  4. Clone the repo in Git Extensions, using the HTTPS link from Bitbucket.
  5. When prompted to log in, keep the default user name (don't change it to your email address), and enter the app password.
  6. A web page will open for you to authorize Git Credential Manager to access your Bitbucket account.
  7. Once authorized, Git Extensions should start downloading the repo.
Rory MacLeod
  • 11,012
  • 7
  • 41
  • 43
  • This doesn't work as of today. Username and password access has been disabled for security reasons and ssh is the only (and correct) way to access Bitbucket. – Vočko Mar 11 '22 at 02:13
  • 1
    This actually works as of today, 17-March-2022. Just noting that this is not the standard username & password, but App Passwords as per the answer above. – chenz Mar 17 '22 at 03:37