No longer able to connect to my various servers with sourcetree Edited

Until today I have been able to connect to multiple git servers (github, bitbucket, 2 private installs of gitlab) using different public keys. 

Today when I tried to push code to these sources I am being rejected due to public key issues.

I ran some experiments with a colleague this morning when the issue first occurred. I'll copy some of the test output below.


MacBook-Pro:~ colinburns$ ssh -v git@sampledomain.com
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/myusername/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to sampledomain.com [112.31.14.252] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/colinburns/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to sampledomain.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:KEYDETAILS
debug1: Host 'sampledomain.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/colinburns/.ssh/known_hosts:43
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/colinburns/.ssh/id_rsa
debug1: Trying private key: /Users/colinburns/.ssh/id_dsa
debug1: Trying private key: /Users/colinburns/.ssh/id_ecdsa
debug1: Trying private key: /Users/colinburns/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

It seems as though the git repository is now looking for id_rsa rather than than the key sample_gitlab which it had been using. I exclusively use sourcetree (rarely resorting to the commandline) to manage my repos so I wonder if this is something to do with the new update???

If I run the command through ssh-agent it works fine.

ssh-agent $(ssh-add ~/.ssh/sample_gitlab; git push -u origin master)

 

To solve this I ran the following command

cp ~/.ssh/sample_gitlab ~/.ssh/id_rsa
cp ~/.ssh/sample_gitlab.pub ~/.ssh/id_rsa.pub

Which solves things for connecting to the Sample Gitlab repo but I'm now unable to push/pull from my Bitbucket repositories.

Any help is appreciated.

Regards,
Colin

2 answers

1 vote

Please file a ticket with details for us to investigate at https://jira.atlassian.com/browse/SRCTREE. Apologies for the hiccup.

Cheers,
Brian Ganninger
Senior Mac Developer, Sourcetree

0 votes

Hi Colin,

One thing that stands out to me is that you have a Gitlab and a Bitbucket repo and you're trying to use the same key for both.

At this point I would generate a new key and upload it to BitBucket and see if you're good to go at that point.

Cheers,

Branden

Ok I'll give it a go - thanks

I did have separate keys for each different server (gitlab, bitbucket) and I didn't have an id_rsa.pub file.

So not sure what changed to cause this...

I'll try your suggestion.


Cheers,

Colin

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

716 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you