How do I use Git Extensions with a Bitbucket repository?
Asked Answered
B

3

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?

Bennir answered 13/8, 2011 at 22:10 Comment(2)
What do you mean by "TortoiseHg SVN"? There is TortoiseHg and TortoiseSVN.Oestrogen
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)Metaphase
N
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-==] [email protected]

  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

Necropolis answered 13/10, 2011 at 16:30 Comment(6)
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!Kuykendall
I second @DTI-Matt's sentiment. I just need to remember to come back here everytime I have to go through this process.Sylviesylvite
It should be noted that the '[' and ']' characters surrounding the public key should not be included in what you pass to bitbucket.Sylviesylvite
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.Spirogyra
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.Necropolis
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).Gutty
S
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. [email protected]: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.

Stercoricolous answered 7/10, 2012 at 23:19 Comment(5)
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.Peacemaker
Found the following very useful: How to install a public key on your Bitbucket account . Includes instructions for using puttygen and very useful screenshots.Peacemaker
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.Peacemaker
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.Stines
I've copy the key directly form git extensions so instead of of txr fileHautbois
O
4

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.
Overbear answered 13/9, 2021 at 12:12 Comment(2)
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.Gutty
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.Lsd

© 2022 - 2024 — McMap. All rights reserved.