Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ, unable to share Project on GitHub (Permission Denied)

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?

like image 994
Lockna Avatar asked Jan 04 '19 12:01

Lockna


People also ask

How do I authorize IntelliJ on GitHub?

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.

How do I share an IntelliJ project from GitHub?

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.


2 Answers

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.

like image 101
MichaelCkr Avatar answered Sep 26 '22 16:09

MichaelCkr


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 -

  1. Open 'PuTTYgen' application.
  2. Click on 'File > Load private key'.
  3. Choose your .ppk file from directory.
  4. Click on 'Conversions > Export OpenSSH key'.
  5. Save the file in 'C:\Users\(your username)\.ssh' folder with 'id_rsa' name.
  6. Open Intellij.
  7. Click on 'File > Settings'.
  8. Expand 'Version Control'.
  9. Expand 'Subversion'.
  10. Click on 'SSH'.
  11. Select 'Private key' radio button.
  12. Select the generated file stored in 'C:\Users\(your username)\.ssh' folder.
  13. 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

like image 35
icl7126 Avatar answered Sep 25 '22 16:09

icl7126