I'm new to Git and GitHub/GitLab. I try to share my project to GitHub but it throws this exception:
Can't finish GitHub sharing process
Successfully created project 'LiveGame1' on GitHub, but initial push failed:
[email protected]: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I'm also able to clone a repository via internet link, but not via "[email protected]:/username/repository_name".
How can I fix this error and am I able to share my project directly to GitLab?
This article helped me get things squared away on my Windows 10 box:
https://richardballard.co.uk/ssh-keys-on-windows-10/
Note: The first section in the article should be titled "Enable the SSH Client in Windows" and should refer to getting the SSH Client enabled, not the server.
If you can get ssh -T [email protected]
working without prompting you for your password, as described in the above article, then you'll be able to push from IntelliJ just fine.
The keys were to:
ssh-add
that is invoked is the one provided in C:\Windows\System32\OpenSSH
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"
When generating your keys with ssh-keygen
consider using the ecdsa algorithm as described here: https://www.ssh.com/ssh/keygen/
Also important was cleaning up anything else that was trying to do ssh outside of windows (like Putty). One problem I kept facing with 'invalid format' when trying to run ssh-add
I believe was caused by a different ssh-add
program on my path that was being used rather than the one from OpenSSH that ships with Windows.