(Running Windows 7, SourceTree 1.5.1.0 configured to use OpenSSH)
When my private key (stored in C:\Users\MyUser\.ssh
) is called id_rsa
everything works fine: I can clone GitHub repositories, pull, etc., using regular GitHub URLs: git@github:my-github-user/my-repo.git.
But when I rename my private key to something else and let SourceTree know about this (under Tools -> Options -> SSH Key) it fails to connect.
Furthermore: if I create C:\Users\MyUser\.ssh\config
and add something like
Host github2
Hostname github.com
User git
IdentityFile something_else
And try URLs such as git@github2:my-github-user/my-repo.git or ssh://github2/my-github-user/my-repo.git, it doesn't work.
It's as if OpenSSH in SourceTree is hardwired to read only id_rsa
and ignore other settings (such as .ssh\config and/or SSH Key).
Ideas?
I am using a private key other than id_rsa, but my configuration is completely different than yours.
First of all, I am not using .ssh to store my key or for any manual config.
Secondly, I am not specifying a specific key in SourceTree options.
Thirdly, I am using Pageant as my key agent, which I DO have set in my SourceTree config. I have Pageant configured to load the key at startup. It seems that SourceTree simply tries to authenticate with any keys in Pageant.
Also, Rafael's instructions seem tailored for Mac/Linux, which isn't going to be particularly helpful since you said you're on Windows.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's interesting, I'll check it out. I was still hoping to understand why OpenSSH (no agent) doesn't work, though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well it works. Unfortunate that I couldn't find any other solution, but for the sake of good order I'll accept this answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nitzan,
Create a SSH config file
When you have multiple identity files or a ssh key different from id_rsa, create a SSH config file mechanisms to create aliases for your various identities. You can construct a SSH config file using many parameters and different approaches. The format for the alias entries use in this example is:
Host alias
HostName bitbucket.org
IdentityFile ~/.ssh/identity
To create a config file for one identity different from id_rsa or two identities+ (workid and personalid), you would do the following:
## Sample 1 Host defaultid HostName bitbucket.org IdentityFile ~/.ssh/id_rsa ## Sample 2 Host customid HostName bitbucket.org IdentityFile /Users/user/Downloads/customid
Now, you can substitute the alias for portions of the repository URL address as illustrated below:
## Sample 1 # original command git clone git@bitbucket.org:accountname/reponame.git # will become git clone git@defaultid:accountname/reponame.git ## Sample 2 # original command git clone git@bitbucket.org:accountname/reponame.git # will become git clone git@customid:accountname/reponame.git
Load each key into the appropriate Git account
You load each identities public key into corresponding account by copying id_rsa.pub and/or customid.pub content and paste it into individual SSH key fields (Deployment keys).
Ensure the ssh-agent is loaded with your keys
List the currently loaded keys:
$ ssh-add -l 2048 32:ad:d1:3c:4b:3b:f4:34:7a:c5:b2:4a:be:8e:d8:9a /Users/user/.ssh/customid (RSA) 2048 68:ef:d6:1e:4b:3b:a3:52:6f:b0:c3:4b:da:e8:d1:9f /Users/user/Downloads/customid (RSA)
If necessary, add your new key to the list:
$ ssh-add /Users/user/Downloads/customid Enter passphrase for /Users/user/Downloads/customid: Identity added: /Users/user/Downloads/customid (/Users/user/Downloads/customid)
Kind regards,
Rafael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rafael -- kindly *reread* my question. You'll notice I did just that, but to no avail. I also made a specific comment re ssh-agent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Those don't look like Windows instructions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.