1. Open Sourcetree, enter settings-account;
2. Choose Add Account, host select BitBucket (or github), connect account, login to existing BitBucket account (or GitHub account), save
3. After successful connection, on the second step of the page will show your account name, SSH key under a "Copy to Clipboard" button, click to copy SSH key;
4. Enter the BitBucket official website, go to the bottom left corner avatar-View profile-settings, select the SECURITY under the SSH keys, click on the ADD key, paste the key there just copied SSH key, save it;
5. You can then create a new warehouse in the Sourcetree client.
6. The problems I have encountered:
My project code is sent to me by my colleague (because it is too big, pull down), Mac in the Decompression folder, there will be more layer (such as decompression Socialbase folder, extracted will be/socialbase/socialbase this). And since the beginning of the use of BitBucket, is the Git version management, now switch to Mercurial, when adding an existing local warehouse, I opened the outermost socialbase, which will cause the Socialbase project has been git, but the folder is not . git file. The workaround is to open the next layer of the Socialbase folder. It's a weird question.
Set up a SSH key with Sourcetree on MacOS