4

I'm actually in the process of setting Atlassian Stash for my Workplace. I've ran into this issue which I'm not able to fix. Note, this is running on a Windows 7 64bits installation.

When setting the SSH Keys, I followed the Stash Guide on how to create them and set them into my account. Still, the issue encountered here isn't really literal as it doesn't seem to accept the key. (Both users created in Stash are Admins and have Admin rights on all repos.)

When executing the simple clone command, I'm getting this error:

$ git clone ssh://git@localhost:7999/test/test.git
Cloning into 'test'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I followed steps written in the Documentation area on the Atlassian website, but I'm still unable to make it work.

Git Operations Fail - Permission denied - publickey

Permission denied (publickey)

$ ssh -p 7999 -I ~/.ssh/id_rsa -vT git@localhost
OpenSSH_6.6.1, OpenSSL 1.0.1m 19 Mar 2015
debug1: Connecting to localhost [127.0.0.1] port 7999.
debug1: Connection established.
dlopen /c/Users/Webit-Alex/.ssh/id_rsa failed: dlopen: Win32 error 126
debug1: identity file /c/Users/Webit-Alex/.ssh/id_rsa type 1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_dsa type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/Webit-Alex/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.14.0
debug1: no match: SSHD-CORE-0.14.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 0e:58:0e:af:a8:a1:35:5b:5e:3c:ac:8a:50:af:13:a9
debug1: Host '[localhost]:7999' is known and matches the RSA host key.
debug1: Found key in /c/Users/Webit-Alex/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/Webit-Alex/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_dsa
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Webit-Alex/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

Does anybody have a solution or is willing to help getting Stash to work properly?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
  • I'd suggest contacting our support team at support.atlassian.com, they can take a closer look. – Rog Jun 12 '15 at 05:19

3 Answers3

1

I had this same problem but trying to reach a remote host instead of local. The odd thing was that it worked fine the night before. I got the exact same errors as the original poster. Finally, I deleted all my SSH keys on the stash server and re-added my previous id_rsa.pub key. I tried it again and it worked fine. Either my SSH key got corrupted on the stash server or the stash server failed to load my key - either way re-adding it fixed the problem.

Mike G
  • 4,232
  • 9
  • 40
  • 66
bandaman
  • 41
  • 2
0

Check if you have your ssh key in /.ssh/id_rsa and /.ssh/id_rsa.pub, sometimes it can disappear or something else can go wrong.

You can update and reset ssh key using this instruction

cheparsky
  • 514
  • 6
  • 20
-2

Check /var/log/auth.log or journalctl -u sshd for any information, such as invalid permissions on keyfiles. Another usual mistake is also to have a typo on authorized_keys.

Reactormonk
  • 21,472
  • 14
  • 74
  • 123
  • Thanks for answering. Could you point me in the right direction as to where I would find those informations (auth.log and journalctl). I've tried finding the log file, but I was unable to do so (Windows environment here) And the journalctl is not a valid command (as my Git Bash prompt is telling me). Thank you again! – Stéphane Desjardins-Larose Jun 11 '15 at 00:38
  • You want to find the sshd log, error messages help with debugging. I don't know the system stash is running on, so I gave you the two most probable ways to find said log. Find out more about their system or contact their support. – Reactormonk Jun 11 '15 at 02:47
  • These files are not relevant to Stash, it runs its own SSHD on port 7999 – Rog Jun 12 '15 at 05:19
  • @Rog That would explain why it's so ancient that it doesn't accept ecdsa keys. – Reactormonk Jun 12 '15 at 07:06
  • The server does accept ECDSA keys, but we (the Stash team) need to update the key validation to accept the public key in the configuration. We're working on it. In the meantime, this would suggest that it isn't an ECDSA key pair that the asker is trying to use. – Rog Jun 13 '15 at 01:53