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?
Select Log In via GitHub. In the browser window that opens, click Create an account and complete the registration process on GitHub. Return to the IntelliJ IDEA settings, click Cancel, and then repeat steps 2 and 3. Click Authorize JetBrains in browser.
You can use IntelliJ IDEA to create a local Git repository and then share the project on GitHub by going to VCS > Share project on GitHub in the menu. This displays the Share Project on GitHub dialog.
There are loads of suggestions here How to solve Permission denied (publickey) error when using Git? and here Git gives me a “Permission Denied” error when writing files that I am pulling depending on the OS.
For me on Windows in IntelliJ the solution has been the one which is mentioned here: Can't access git using SSH keys.
I edited the ssh_config-File within the git-Installation, which IntelliJ uses with the Host of the sources and all worked.
File e.g.:
C:\Program Files\Git\etc\ssh\ssh_config
Change within the file e.g.:
Host bitbucket.org
IdentityFile C:\Users\User\.ssh\id_ssh
Edit: As mentioned in a comment (for Linux), it is also possible on Windows, to add a config file in your lokal user home directory: C:\Users\<USER>\.ssh\config
with the mentioned hostname(s) from above. This may be the better solution, if you are using multiple git-Installations or don't have access (due to missing admin-permissions) to your git-Installation.
I'm using Windows 10 and PuTTY authentication agent (with password protected SSH key) and this worked for me - for my Bitbucket and Github accounts where I uploaded my SSH key.
Steps to integrate 'SSH' key in Intellij -
- Open 'PuTTYgen' application.
- Click on 'File > Load private key'.
- Choose your .ppk file from directory.
- Click on 'Conversions > Export OpenSSH key'.
- Save the file in 'C:\Users\(your username)\.ssh' folder with 'id_rsa' name.
- Open Intellij.
- Click on 'File > Settings'.
- Expand 'Version Control'.
- Expand 'Subversion'.
- Click on 'SSH'.
- Select 'Private key' radio button.
- Select the generated file stored in 'C:\Users\(your username)\.ssh' folder.
- Click on 'Ok' button.
Test configuration: Click 'VCS > Git > Fetch'. If 'Fetch Successful' message displays, your configuration is successful
Source: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000011270-How-to-set-up-git-SSH-keys-?page=1#community_comment_360001445600
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With