Sourcetree Import Ssh Key Mac



SourceTree reset SSH key Mac. I use SourceTree + BitBucket combination with SSH setup on my Mac. It used to work fine. Haven't used this Mac to code for a while. Today I tried to do fetch / push, all failed with this permission denied (public key) issue. I've done some research, tried the solutions in this article https://confluence.atlassian. In case it helps others, my issue was that I had an invalid local user.signingkey set, which I didn't notice in my sourcetree configuration, nor my global settings (because I didn't think to look at local config) Ensure both local (git config -local -get user.signingkey) and global (git config -global -get user.signingkey) are the same, or even better, unset the local one if it is invalid.

Click to get the latest Buzzing content. Take A Sneak Peak At The Movies Coming Out This Week (8/12) Everything we know about ‘Shang-Chi and the Legend of the Ten Rings’. 3) Import the function to profile first. The profiler is executed from the parent directory of the profiled code (this doesn't matter if you choose a custom shell command). Use the profile. Atlassian Sourcetree is a free Git client for Mac. (holding Shift or Control key while clicking) and then clicking the Open button. To import non-nucleotide.

After a recent laptop upgrade, I needed to reset my access to BitBucket from my new laptop, and figured this post might save some hassles for other folks trying to do the same.

Mac

Sticking with Windows for my OS when most other developers have moved to Mac might strike some readers as a strange thing: for me, it is a mixture of wanting the OS to be something I never think about (I care much more about the setup of my Chrome browser) as well as always being a bootstrapper (the equivalent Mac to my Samsung Ultrabook is another 30% more) means I’d rather stick with Windows (until I can really do without MS Office, at which point I’ll happily go Linux, but Google Docs isn’t there yet and being a CEO means a lot of spreadsheet and presentation work).

Ssh Key Github

The problem, though, is being an outlier from a dev perspective means the instructions/process isn’t always so clear – now we know how Mac users have felt for 20 years!

SourceTree and PuttyGen/Pageant

When you’re using SourceTree you’ll probably be using it alongside the excellent Putty package (download it here; I recommend using the “Windows Installer” option half way down the page). When installed, this package includes a handful of utilities; the three we care about here are:

  • PuTTY: this is used for making SSH connections. You don’t actually need it for SourceTree things, but you’ll almost certainly need it for lots of other things.
  • Pageant: this is a background, resident app that handles the SSH handshake from your Windows apps, including SourceTree.
  • PuTTYgen: this is the key generation app for Windows which makes it easy to create public/private keys.

Sourcetree Load Ssh Key

The process of getting SourceTree to work nicely with key based access is:

  1. Use PuTTYgen to create a public/private key pair. Save the private key to somewhere safe on your local machine.
  2. Select/copy the public key section (the bit in the top grey window of PuTTYgen when the key has been created) and paste it in as a new SSH key in your BitBucket Account page under SSH Keys (the URL will be something like https://bitbucket.org/account/user/YOURUSERAME/ssh-keys/)
  3. Each time you boot your machine, fire up Pageant and “Load” your private key from step 1 – this will then “authenticate” your push, pull, fetch and other remote requests against BitBucket.

SourceTree’s Coolest Feature on Windows – the Terminal

However, if you’re like me, you’ll quickly tire of having to always use the SourceTree UI – it can be really slow and clunky (thanks Java). In this case, you’ll want to use the “Terminal” option in SourceTree.

When you click on the “Terminal” option, you get a fairly fully featured Linux-like terminal right there on your machine. This terminal makes it easy for you to do things like pulls, pushed, checking out other branches, changing the permissions on a file to make it executable – everything you want to do at the Git command line, and a lot more.

The problem with this Terminal, though, is that it doesn’t get the benefits of Pageant’s private key access – if you try and do a push or a pull or anything else that requires authentication to BitBucket, you’re going to get an access denied situation.

Enabling SSH Key access from the Terminal

As mentioned, the Terminal is more than just a command line interface for Git – it has a lot of built in Linux functionality there (I haven’t explored/dug in to work out how much). However, because it is running as an emulated environment within Windows, but not really as part of it, you need to set up your own keys.

The process is as follows:

  1. Fire up the terminal by clicking on the “Terminal” button in SourceTree. It doesn’t matter which repository you launch the terminal from since we’re going to be affecting your whole terminal environment.
  2. Type in ssh-keygen -t rsa -C ‘your.email@address.com’ (obviously replacing the email address with your own account).
  3. Accept the defaults, and enter a passphrase if you want to be prompted to enter one each time you use the key.
  4. You’ll then need to copy the public key (located at C:UsersYOURUSERNAME.sshid_rsa.pub – right click and open it in Notepad) to your clipboard.
  5. Finally, you’ll need to paste the public key into your BitBucket Account page under SSH Keys (the URL will be something like https://bitbucket.org/account/user/YOURUSERAME/ssh-keys/).

Once you’ve done this, you’ll be able to run “git pull” and “git push” in your Terminal and interact with the BitBucket server.

Sourcetree import ssh key machineSourcetree Import Ssh Key Mac

Ok so the title is a little dramatic, but I had just run the same provisioning script multiple times only to have it fail when trying to clone a Bitbucket GIT repository. Luckily I resolved everything, which is why I am here chirpily regaling you with my story instead of picking up bits of smashed up keyboard as a result of a temper tantrum (embarrassingly, this has actually happened). So how did I do it? Well first lets have some backstory…
I work on a MAC. I used to run GIT in the terminal because it made me feel like I was Keanu Reeves as Neo in The Matrix. This was right up until the point that I had conflicts, at which point I would delete everything and feel more like Keanu Reeves playing any character with more dialogue than “uhhh”. Fortunately a good friend of mine, who we’ll call Riaan, because that is indeed his name, convinced me that it was ok to use a GUI. Now I don’t touch GIT without SourceTree making everything look friendly. I even resolved some conflicts earlier (without resorting to “bash their heads together”, which is my default method when it comes to my kids conflicts).

As an enlightened developer, I also use GIT repositories. I like Bitbucket because it allows for private repositories for free. This is good for two reasons: 1, because I am writing code for companies who don’t want other people accessing it, and 2, because I am petrified of anyone seeing my code and discovering the vast depths of my incompetence. The latter is, I hope, partly due to unhealthy levels of imposter syndrome, but I don’t want to take the chance yet.

Fortunately, most of my repos contain code by me, for me, because like most self-respecting super-heroes and maverick movie cops, I work alone (this may also be influenced by point 2 above). However, from time to time, I need to work with other developers. The brilliant “Creativity INC” by Ed Catmull recommends that you always hire people who are cleverer than you. I suspect Mr Catmull takes longer to find such people than I do, but I took his advice, and hired a developer who is far cleverer than I am. We thrashed out a few ideas and got to work. Not long afterwards, I was still doodling ideas on a piece of paper and he had written a provisioner to install a site bootstrap on my local Vagrant install. Unfortunately, while provisioning, this attempts to clone a GIT repo. This can’t be done without SSH. I read SSH as SHHHHHHH. I also make this noise whenever someone tries to talk SSH to me. Sadly provisioning scripts don’t listen to me, so I had to sort my act out. This is what I did:

1. Open a Terminal, and pretend you’re Neo.
First CD into the .ssh directory, and generate an ssh key.

Give the key a name if you don’t want the default. I saved mine as id_site_bitbucket where site was the name of the site the keys were for. This is just to (hopefully) aid my swiss cheese brain when I happen across these in future.

Enter a passphrase when prompted, and save it to your password manager (because you do have a password manager and don’t just scribble passwords on a piece of paper or use admin123 as your password right?)

Copy the key to clipboard. Note that I am using the key name I generated, replace this with whatever you used for your key. Also note that we are copying the public key, hence the .pub extension (I assume? I’m winging it on that one).

nb: I am assuming you are still in the .ssh directory here, cd ~/.ssh if not.

2. Login to Bitbucket, and click yourself
(or the mystery man icon if you are too lazy to set your profile up like I am) – its bottom left of the screen.
Select “Bitbucket Settings” from the menu.
From the “Security” section that then loads, select “SSH Keys” (nb you may need to actively enable SSH keys if you haven’t already, take a look at the Atlassian site for more on this if so).
Download cooking mama 3 nds romtreecost. Click to “Add Key”, and paste your key (that you copied to clipboard via the command above) into the “key” textarea. I named the key the same as the name of the public key (id_site_bitbucket.pub) for further clarity and hopefully a “Eureka” moment at some point in the future when I try and recall all of this.
Click “Add Key”.

3. Now we get to the point that stumped me for a bit.
If you want to feel my pain, try and checkout a GIT Repo from your bitbucket account using the SSH URL. It won’t work (or didn’t for me). Then google and find endless instructions on setting up SourceTree with SSH keys that all reference Windows versions and menus that don’t appear to be on the MAC version.

Factorytalk activation crack. Alternatively…

4. Head back to the Terminal
cd back into .ssh (if you aren’t still there) and type the following:

You will then be prompted for the passphrase for the key.
This adds the key to your built-in keychain, which allows your MAC’s native SSH client access to it (please don’t ask me what this actually means, just let me recite it knowingly, and we can all walk away from this with our pride intact).

Thursday 29th June 2017: Pride comes before a fall as they say. Happened to turn my Mac off last night (usually leave it on), logged in this morning, and it turns out that the key is no longer in my keychain. Yet to find out how to permanently add this to keychain, so be aware you will have to run the ssh-add command every time your MAC has restarted should you wish to make use of your key. If I find out a better way around this, I’ll update the post. Feel free to leave a comment if you have any suggestions.

Thursday 13th July 2017: See how to automate this here

5. Quick trip back to BitBucket
Copy the SSH URL for your GIT repo

6. Open SourceTree
Click “New” and select “clone from URL”.
Paste in your repo’s URL and you should be good to go!
In my case, this means running the provisioner for the 679th time, and what do you know, its working!!

Sources: