Problem
Cloning a private GitHub repository through File | New | Project from Version Control | GitHub fails with the following error, even when the GitHub account is already authenticated in the IDE:
git@github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Cloning the same repository using the HTTPS URL provided by GitHub succeeds.
Cause
By default, the IDE clones GitHub repositories using the SSH protocol. The error indicates that no valid SSH key is registered with the GitHub account, or the local SSH agent does not provide the matching private key.
GitHub authentication configured in the IDE handles HTTPS access via OAuth tokens. SSH cloning relies on a separate SSH key infrastructure that must be configured independently — logging in to GitHub from the IDE does not provision SSH keys.
Resolution
Choose one of the two options below.
Option 1: Configure an SSH key for GitHub
- Generate a new SSH key and add it to the SSH agent.
- Add the public key to the GitHub account.
- Retry cloning the repository in the IDE.
Option 2: Clone over HTTPS instead of SSH
- Open Settings (Ctrl+Alt+S on Windows/Linux, ⌘, on macOS).
- Navigate to Version Control | GitHub.
- Disable Clone git repositories using ssh.
- Retry cloning via File | New | Project from Version Control | GitHub.
Comments
0 comments
Please sign in to leave a comment.