Sublime Forum

Permission denied, could not read from remote repository

#1

When I try and do anything I get this error:

[code]git@stash.hiddenltd.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.[/code]

I know I have permission, SourceTree still pulls/pushes.
Pageant is running, my publickey is in C:\Users\myuser.ssh and I’m on Windows 10.

How do I get Sublime Merge to see the public key ?

0 Likes

#2

You mention pageant. Have you set the GIT_SSH environmental variable to plink.exe?

0 Likes

#3

I have not, nor do I know how to. How does one go about doing so?

0 Likes

#4

Hmm. Pageant is an ssh key agent for PuTTY and it’s tunnel variant plink.exe. If you haven’t ever set up plink.exe, what do you use PuTTY for? Does SourceTree default to using Pageant?

You mentioned you have your publickey in C:\Users\myuser.ssh. Do you also have your private key there? What is the file name of it? If it ends in .ppk, it is a PuTTY/plink.exe/Pageant key. If it is named id_rsa and has a corresponding id_rsa.pub file, it is for use with ssh.exe, which is the default SSH implementation for Git on Windows.

If you haven’t changed the environment variable named GIT_SSH, then Sublime Merge (and command line Git for Windows) should be using ssh.exe. It is possible that you told the Git for Windows installer to use plink, but that should have set the environmental variable for you.

If you are on Windows 10, you should be able to type “Environment” in the start menu and select “Edit environment variables for your account” to check and see if anything is set.

1 Like

#5

I’ve just got home and had the same issue, I’m assuming for the same reason as my work machine. Both have Pageant on because it comes with SourceTree.

(For anyone else with this problem, it’s located in: C:\Users\myuser\AppData\Local\SourceTree\app-2.6.10\tools\putty\plink.exe)

Adding that in the Environment variables like you said has sorted it out. When I tried having ssh.exe from C:\Windows\System32\OpenSSH in the Environment variables it didn’t work. I’m hoping to move away from SourceTree completely (it’s awful!), so will look at installing Pageant independently of SourceTree.

Thanks.

0 Likes

Getting permission denied publickey errors when pushing to origin
#6

Hi,

I am getting the same error message.
Now I know that it finds my SSH key, because right before my public key had the wrong (putty) format and SublimeMerge complained about that so I changed it to the OpenSSH format.

However, now I am getting the error that OP mentioned when trying to freshly clone a repo and I don’t know why.

Using TortoiseGit e.g. works just fine, but SublimeMerge will keep complaining whenenver it needs to connect to the repository.

Is there/can you please provide a step by step “How to use SSH with SublimeMerge” (which ssh key format does it use, where do we need to copy the keys to, do we need to set any magic env variables,…) guide? I apologize if that already exists and I have missed it.
(ps, switching from SSH to HTTPS works just fine, however I don’t always have that option so i need to get SSH working reliably)

thanks a lot!

1 Like

#7

Do you have a id_rsa.pub and id_rsa? I still have this problem on my machine at work, where I don’t have these two files… I’m assuming once I’ve bothered to create those it’ll work properly.

0 Likes

#8

hmm, I don’t at the moment. meaning, I have numerous ssh keys (for numerous different servers) in my %HOMEPATH%.ssh, and tools like TortoiseGit let me tell it which key to use. but I did try renaming the key I need to id_rsa and no luck with that either… so shrugs

In the end… whatever I need to do: SublimeMerge really needs to handle the key situation better and by itself (and I only tell it, hey that server? yeah use this key for that…)

0 Likes

#9

Ok, for those having the same issue, I managed to work around this doing the following:

create a file called “config” (no extension) in your %USER%.ssh folder and add an entry like this for every separate (or even just one) host that you have:

Host github.com
    User your_username
    HostName github.com
    IdentityFile ~/.ssh/my_private_key_file_for_this_host_in_openssh_format

now, if you’re like me and you are using puttygen, make sure that you export the private key in the OpenSSH format (-> Conversions -> Export OpenSSH key) and copy the text in the “key” field (the public key) as is into your public key file.

This works, however this is something we really should be able to do from within SublimeMerge (also… can we please specify where that config file is located and not assume it’s in %USER%.ssh ? This is really inconvenient.

Thanks a lot!
Cheers

0 Likes

#10
I also encountered this problem. When I modified the git repository address, the same problem occurred. I used the Cmder terminal tool on windows10. I found that the settings took effect after I quit the terminal. Merge also recovered. I hope I have the same problem. People can refer to.
0 Likes

#11

Hi @wbond,

SourceTree does indeed default to using pageant (in fact, when you install SourceTree and load an SSH key, it launches and uses pageant for this.).

So I see 2 things that would be nice to happen here:

  1. If pageant is running, sublime merge should use the ssh keys.
  2. sublime merge should provide it’s own simple mechanism for loading ssh keys

Making hosts entries and these other workarounds are quite cumbersome

0 Likes