Reputation: 9389
When I try to clone a repo I get a git failed with exit code 128
.
Also when I try to push/pull I get a [email protected] public key denied
.
In my ~/.ssh folder I have a config
file that looks like this:
Host mycompany.gitlab.com
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab-company-bryan
git in the terminal works fine but Sublime Merge I am getting permissions errors.
What do I need to do so that Sublime Uses this public key? I'm super confused and get it to work at the moment.
Upvotes: 7
Views: 7889
Reputation: 21
For those interested, I got it working on Ubuntu 18.04 by first starting ssh-agent from the command line, then add my key to ssh-agent using the 'ssh-add' command, and then from within the same opened tty, launch Sublime Merge on the current directory with the following command:
smerge . &
This way, every time Sublime Merge is using your ssh key, the ssh-agent process running in the background will handle the password entering for you.
Upvotes: 2
Reputation: 1326746
git in the terminal works fine but Sublime Merge I am getting permissions errors.
First:
The private key has been generated with Git 2.19.2, meaning an openssh 7.8+, which has just changed its private key default format, from PEM (64 characters per lines) to "OPENSSH" (70 characters per lines).
See "Jenkins: what is the correct format for private key in Credentials"
Try and regenerate a private key (and register it on GitLab), but this time with:
ssh-keygen -m PEM -t rsa -P "" -f mynewkey
That is to rule out any interpretation error of that key by Sublime Merge.
Second, as the OP discussed here, SSH private keys with passphrase don't seem to be supported, unless the ssh-agent is properly configured to cached said passphrase.
KeyChain on macOS handles everything for me (without any ssh config; I'm still using the default id_rsa for all of my repos).
The OP bryan confirms in the comments:
I finally got it working with:
ssh-add -K ~/.ssh/[your-private-key]
The
-K
option is in Apple's standard version ofssh-add
, which stores the passphrase in your keychain for you when you add an ssh key to the ssh-agent.
Upvotes: 8