Sourcetree Mac Ssh Key

Posted onby

第1步:创建SSH Key。在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有idrsa和idrsa.pub这两个文件,如果已经有了,可直接跳到下一步。如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key: $ ssh-keygen -t rsa -C '[email protected]'. ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxx. Google之后明白,文件夹内少了一个knownhosts文件,本来密钥文件应该是三个,现在只有两个,便报了这样的错误,此时输入yes回车之后,生成了缺少了的knownhosts文件,便可解决这个问题: ```. Make sure your Mac OS X system is updated to the latest version. Follow the install wizard to complete the. Download Sourcetree from here. Click on Download for Mac OS X. Install Sourcetree. Create SSH Keys (Sourcetree) Open the Sourcetree application and under the top Sourcetree menu click on the Preferences.

  1. Sourcetree Mac Ssh Key
  2. Mac Sourcetree Ssh Key 設定
  3. Sourcetree Mac Ssh Key Windows 10
  4. Ssh Add Key Mac

SSH Keys on macOS

What are SSH Keys?

SSH (Secure Shell) keys are an access credential that is used in the SSH protocol.

The private key remains on the system being used to access the HPCC cluster and is used to decrypt information that is exchanged in the transfer between the HPCC cluster and your system.

A public key file is used to encrypt information, and is stored on your own system.The public key file is stored on the HPCC cluster and contains a list of authorized public keys.

Why do you need SSH Keys?

HPCC supports two authentication methods; Password+DUO and SSH Keys.The Password+DUO method requires a UCR NetID, if you do not have this then you will need to use SSH keys in order to access the HPCC cluster.

What you need


You will need to install Filezilla in order to transfer the public SSH key to the HPCC cluster.

  1. Download the Filezilla Client for Mac OS X here.
    • Make sure your Mac OS X system is updated to the latest version.
  2. Follow the install wizard to complete the install of Filezilla.


You will need to install Sourcetree in order to generate your SSH keys (or use the command line method mentioned here: Manage SSH Keys via Command Line.

  1. Download Sourcetree from here.
  2. Click on Download for Mac OS X.
  3. Install Sourcetree.

Create SSH Keys (Sourcetree)

  1. Open the Sourcetree application and under the top Sourcetree menu click on the Preferences... sub-menu item.

  2. Navigate to Accounts category and click on Add....

  3. Click on Auth Type: and change the drop down menu from OAuth to Basic. Make sure Protocol: is set to SSH in the drop down menu.

  4. Enter id_rsa in the Username field.

  5. Click the Generate Key button.

  6. Press Cancel to exit out of the window.


SSH Keys Location

By default, your key files are created in the path: /Users/macOSUsername/.ssh/.

SourcetreeSourcetree Mac Ssh Key

To verify that the keys were created, do the following:

  1. Open a new finder window. Click on your home directory on the left side pane.

  2. Press the 3-button combo Command+Shift+. together (visualized below) to see hidden folders:

  3. You will now be able to see your .ssh folder, open it by double-clicking.

  4. You should see your newly generated pair of SSH key files in the folder.

  5. Sourcetree adds the -Bitbucket to the end of the SSH key file names. Remove this by clicking on the file you want to rename and press the Enter key which allows us to rename the file before the extension.

  6. After you have removed the -Bitbucket suffix from each of the SSH key file names, your new SSH key file names should be id_rsa and

Configure SSH Keys

Public SSH Key

Now that you have created your SSH keys, and renamed them, you will need to placed the public key ( on the cluster using the server.

  1. Start the Filezilla application.

  2. Fill in the Quickconnect fields at the top of the application window:

    • Enter your HPCC username in the Username field.
    • Enter the HPCC servername for the Host field.
    • Enter your password in the Password field.
    • Enter 22 in the Port field.
  3. Click on Quickconnect

  4. If a pop up prompts you to save your password, select the Save passwords option, then click the OK button.

  5. If the next pop up prompts you, then check the box that states Always trust this host, add this key to the cache, then click the OK button.

  6. Now that you are connected to Filezilla transfer your public SSH key from your macOS system by dragging the file /Users/macOSUsername/.ssh/ and dropping it into the HPCC cluster direcotry /rhome/username/.ssh/.

Private SSH Key

Once your public key is in place, now you can configure Filezilla to use your private SSH key and connect to the cluster through the server.

  1. Open Filezilla Site Manager button in the top bar of icons.

  2. Click on New Site, rename it (optional) and press enter.

  3. Make sure the following fields are correctly filled before adding your SSH key file:

    • Protocol: should be set to SFTP - SSH File Transfer Protocol
    • Host: type in
    • Port: type 22
    • Logon Type: set to Key file
    • User: type in your HPCC username

    After these fields are finalized, click the Browse.. button.

  4. Navigate to the folder you saved your key file in (default location is /Users/macOSUsername/.ssh) and open the private key file id_rsa.

  5. You should see the added keyfile in the Key file: box, then click Connect.

    Subsequnt connections can be done from the Quickconnect history by clicking on the down arrow to the right side of the Quickconnect button.

  6. Remember to select the address.

  7. Transfer files by double clicking or drag-n-drop. For more details regarding file transfers vist Filezilla Usage.

For the past year or so, we’ve been using Git as our version control system. My introduction to the GUIs around Git was SourceTree (although I’ve made an effort to learn the commands) but I have also used poshgit and Git Bash. Recently, we’ve started using SSH keys instead of HTTPS and I had to learn how to set up my repositories with SSH. Everywhere and everyone tells you this is straight forward and it is when the critical path works but when something is wrong, it gets more difficult. A lot of unnecessarily complex documents does not help either. So I’m going to details all the steps that I took in the hope that it could helps someone.

My setup for this task is Git (you can use the embedded git within SourceTree), SourceTree and BitBucket (previously used Google Drive to host my git repositories).

Sourcetree Mac Ssh Key

  • Open SourceTree and click on the Terminal icon (this is Git Bash)
  • Type the following command in
    • ls –all ~/.ssh (this will list any existing ssh keys in C:Users.ssh, this is the default but can be changed when generating the key).
  • Next, generate the key
    • ssh-keygen –t rsa –b 4096 –C
    • It will ask you where you’d like to store the files, I accepted the default but you can specify a directory if you wish.
    • Then enter a passphrase, I would recommend you provide a passphrase from a security standpoint.
    • You should now see this this:
  • There should be two key files id_rsa (private) and now created.
  • Still using the terminal (Git Bash) in SourceTree, type:
    • eval $(ssh-agent). There are many ways to start the SSH agent but this is only way it would work for me. It should give you a process id back, something like, Agent pid 1234
  • Finally using this command to add the new key
    • ssh-add ~/.ssh/id_rsa
    • If successful, the output should say that an identity has been created.
    • You should never have to type in the passphrase again.
  • Log into BitBucket
  • Select the icon on the top right of the browser and select Manage Account
  • From the Security menu, select SSH Key then Add Key
  • Add you public key ( to the text area and then Add Key again

Note, your public key in this file is in a different format from what BitBucket expects. My recommendation for this scenario is to go to SourceTree – Tools – Create or Import SSH Keys. This starts a Putty Generator that has the ability to load existing keys. The generator will then show the public key in a user friendly format to be copied and used within BitBucket.

In Stage 1, the SSH key was generated and set up for the Git Bash terminal, now we want to take that SSH key and use it within the SourceTree GUI.

  • First step is to go to Tools – Create or Import SSH Key
  • Load your existing private key in.
  • Click on “Save Private Key”. This has to be saved in the Putty .ppk format. I would recommend that you didn’t save this private key to the .ssh folder in case of conflicts between two keys.
  • Next is to launch the SSH agent – Putty comes with SourceTree.
  • Make sure Pagent is running ( little computer with a hat on sitting in your windows tray).
  • Add the key to the SSH agent by right clicking on Putty Pagent and selecting “Add Key”. It is Pagent that stops the user from entering the passphrase all the time by holding key and making it available to SourceTree.
  • A further step is to add the .ppk key to Tools – Options – General – SSH Client Configuration.

That’s it! I was all around the houses trying to fix various errors and configure. Some of the problems I faced were:

  • Permission denied (public key). I believe it was a combination of errors on my part. One, I had created too many key files in the .ssh directory and it didn’t know what one to choose. Second, I hadn’t set up SourceTree correctly. The SSH key had to be a .ppk key and not the id_rsa key, which I’d generated.
  • Could not open a connection to your authentication agent. I believe this was down to me changing from Putty to OpenSSH. OpenSSH just never launched, no wonder it couldn’t get a connection.
  • It took ages to clone a repository. SourceTree GUI doesn’t give a lot of feedback with what is going on, not like Git Bash. I thought it wasn’t working.

My tip would be to test the connection using “ssh –T [email protected]”. This command with provide decent feedback if you have or haven’t authenticated. So open Git Bash and type this in.

Mac Sourcetree Ssh Key 設定

A good topic for debate is why go to all the trouble of using SSH keys? Why not, use HTTPS and cache you account details in winstore?

Sourcetree Mac Ssh Key Windows 10


Discovered this morning that if you shut SourceTree down, if you use the Git Bash terminal, you will need to repeat Stage 2.

Ssh Add Key Mac