SourceTree SSH Setup Instructions

Configure SourceTree on Windows to use SSH keys for GitHub access.

1. Generate an SSH Key

If you don't already have one:

  1. Open Git Bash or PowerShell on Windows.
  2. Generate an SSH key:
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. Press Enter to save to default location (C:\Users\YourUsername\.ssh\id_rsa).
  4. Optionally add a passphrase for extra security, or leave blank.

2. Add SSH Key to GitHub

  1. Copy the public key:
    cat ~/.ssh/id_rsa.pub
  2. Log in to GitHubSettings.
  3. Go to SSH and GPG keys in the sidebar.
  4. Click New SSH key, add a title, paste your public key.
  5. Click Add SSH key.

3. Configure SourceTree

  1. Open SourceTree.
  2. Go to Tools → Options.
  3. In the General tab, set SSH Client to OpenSSH.
  4. Under SSH Keys, ensure your private key (id_rsa) is loaded.

4. Test SSH Access

In Git Bash or PowerShell:

ssh -T git@github.com

Success message confirms the setup is correct.

5. Clone Repository in SourceTree

  1. Click Clone in SourceTree.
  2. Source Path / URL: Enter your GitHub SSH URL (e.g., git@github.com:YourUsername/YourRepository.git).
  3. Destination Path: Choose local folder.
  4. Click Clone.

Troubleshooting

If SourceTree still prompts for a password:

  • Verify SSH Client is set to OpenSSH in Tools → Options → General.
  • Confirm the public key is added to GitHub under SSH and GPG keys.