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:
- Open Git Bash or PowerShell on Windows.
- Generate an SSH key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" - Press Enter to save to default location (
C:\Users\YourUsername\.ssh\id_rsa). - Optionally add a passphrase for extra security, or leave blank.
2. Add SSH Key to GitHub
- Copy the public key:
cat ~/.ssh/id_rsa.pub - Log in to GitHub → Settings.
- Go to SSH and GPG keys in the sidebar.
- Click New SSH key, add a title, paste your public key.
- Click Add SSH key.
3. Configure SourceTree
- Open SourceTree.
- Go to Tools → Options.
- In the General tab, set SSH Client to OpenSSH.
- 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
- Click Clone in SourceTree.
- Source Path / URL: Enter your GitHub SSH URL (e.g.,
git@github.com:YourUsername/YourRepository.git). - Destination Path: Choose local folder.
- 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.