Reputation: 35
I use VS Code as my editor and am using BlueHost to host a series of domains and websites. I have installed git onto BlueHost and created a repository there. I've cloned that repository locally.
When pushing commits using git push origin master
on the command line, I am prompted for the password to my BlueHost account, and everything operates as expected. When using the 'Push' menu option from the Source Control tab on VS Code, however, I am not prompted at all and get the error message:
Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I read through loads of similarly-posed questions and tried a number of potential solutions, including generating an SSH key on BlueHost and putting that key in my .ssh folder (tried with both public and private keys) and also generating keys using ssh-keygen
and importing the public key to BlueHost, but haven't made any headway. I'm starting to think this issue may be a corner case with my particular combination of services being used.
Any ideas?
Upvotes: 0
Views: 9432
Reputation: 13
Make sure your SSH config is all right (in /etc/ssh/sshd_config for debian/ubuntu) :
Then restart SSHD with the good old /etc/init.d/ssh restart (yes, yes, there are better methods, but this still works and do the right thing :-))
Upvotes: 0
Reputation: 6337
Your problem appears to be that you’ve generated the SSH key all right, but haven’t told your computer to use it. To verify this, try using ssh -v user@hostname
(verbose mode), which will show you what keys your computer attempts to present to the remote host.
If that is indeed the issue, it’s simple to fix. You’ll need to add the SSH key to your SSH agent so that your computer knows to try using it. I don’t know what OS you’re using, but for example, on Mac OS, you’d do ssh-add path/to/key-file
. GitHub has an excellent set of instructions at https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ , which you should follow (these instructions should work with any Git remote, not just GitHub). VS Code may have some sort of key management UI in its Git module; I’ve never used it, so I have no idea.
Upvotes: 4