Sublime Forum

How to add public key?

#1

How do I add my GitHub public key to Sublime Merge?

3 Likes

#2

I was encountering the same issue.

I solved it by manually setting the git_binary path in the settings and restarting sublime merge.

0 Likes

#3

I tried that but still getting a Permission Denied (public key) error when pushing. :confused:

1 Like

#4

Is there some SSH setting I can point it to perhaps? Using GitKraken normally and it just takes a path to the public and private keys.

0 Likes

#5

Hello, this is a major show stopper for us.

0 Likes

#6

if it works on the terminal, it’ll work for Merge, so the real question is not

but

How do I add my GitHub public key to Git?

which is readily available info on the interwebs. Or if you’re on a Mac, this may also be useful info

0 Likes

#7

Well I have my keys in ~/.ssh and that works fine from the terminal but not for Sublime Merge.

I’m in no way an expert on this, quite the opposite, so specifically the question for me then is how to get Sublime Merge to know about those keys?

Another question could also be, should I have the keys in the osxkeychain instead (I’m assuming that they would get recognized from there)?

0 Likes

#8

I solve this problem with adding my ssh key in keychain: https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically

2 Likes

#9

Awesome, thank you for this suggestion. It solved my issue too.

0 Likes

#10

Is there a solution to this with Windows/GitBash?

2 Likes

#11

I now have the same issue, but the setting might be the problem: I have a git repo from bitbucket cloned using the Ubuntu subsystem in Windows 10. I cloned it into the mounted directory, so I can work on the files with the Windows software “Sublime Merge” and “Sublime Text”.
This setup works fine with a git repo hosted on github, but with my repo hosted on bitbucket, I can only use the git command line tool inside the subsystem (bash shell) for pulling and pushing the repository. Pulling or pushing using Sublime Merge (Windows) fails with this error message:

git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

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

The ssh key exists in the subsystem. So I guess I have to find a way to share this ssh key with Windows somehow… Possibly this is the issue for many folks here.

Edit: Obviously I was right for at least my issue - I followed https://stackoverflow.com/questions/31813080/windows-10-ssh-keys and created a separate ssh key pair for my Windows 10 system and then added this Windows key to my bitbucket ssh keys. Now I can use both, the subsystem’s ssh key and the Windows ssh key, i.e. both, command line (bash) and Windows tools (Sublime Merge) work fine for the same repository.

0 Likes

#12

Despite having an ssh key setup (as in previous comments) my Sublime Merge asks for a password.
My key does not contain a password.
How do I resolve this?

0 Likes

#13

Excuse me, but what do you mean? When you generated your key, did you not enter a passphrase for it? This is what SM is asking for. It is possible that you did not enter a passphrase in which case what SM is expected is just an empty password.

0 Likes

#14

I assume the password is a blank string, yes, but this isn’t accepted.
I also noticed that the error message doesn’t mention my email but a generic looking one.

0 Likes

#15

Adding something odd when I tried the “debug” option in command line.
When using GitBash, everything purrs, but when I try from a plain Windows “cmd” I get a copy of the above screenshots error message.

When I debug ssh I get this:

C:\Users\dummyuser>ssh -Tv git@server.server.com
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Connecting to server.server.com SOME IP ADDRESS port 22.
debug1: Connection established.
debug1: identity file C:\Users\dummyuser/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\Users\dummyuser/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to server.server.com:22 as ‘git’
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:l9HnoLc5oBidlZgQfL3L38Mv2X4ubBiwX7ChsDCD2D0
debug1: Host ‘server.server.com’ is known and matches the ECDSA host key.
debug1: Found key in C:\Users\dummyuser/.ssh/known_hosts:1
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: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:BIG HASH HERE C:\Users\dummyuser/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to server.server.com SOME IP ADDRESS
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
Welcome to GitLab, @dummyuser!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3268, received 3264 bytes, in -4.2 seconds
0

0 Likes

#16

And, I seem to have fixed it!

I noticed some rumblings about a drive labelled “Z”, which I found, that contained Z:.ssh
So I put my public/private key in there and boom, it works.

It call came down to a very odd “home” setup, I think, but now it works fine.
I knew the issue was all on me! Thank you for the help.

0 Likes

#17

Came looking for help with the same issue. On Mac, at least, adding my ssh key to the keychain worked as @pushrset suggested

0 Likes

#18

This might be a bit too late but I had similar problems and it seems that the culprit was the way I cloned the repo. Make sure you clone it using the ssh link, and not the https.

1 Like

#19

You can use C:\Windows\System32\OpenSSH\ssh.exe instead of the one from the GitBash.

  1. Enable/Install OpenSSH
  2. Win+Rservices.msc
  3. Find the OpenSSH Authentication Agent service and start it
  4. If you want to start ssh-agent on startup, then change its Startup type to Automatic
  5. git config --global core.sshcommand "C:/Windows/System32/OpenSSH/ssh.exe"
  6. After a restart everything should work fine in Sublime Merge and in Git Bash
2 Likes