Problem
Git Integration for Jira application SSH keys:
- Must not be created using the OpenSSH format
- Must be the private SSH key
- Must use the supported certificate format: RSA
- Must use the supported storage format: OpenSSL PEM
Diagnosis
Jira admins will see a message similar to the one below when adding the SSH key:
The key format is invalid. Please check your private key.
Full error (stack trace) available in the Manage Git Repositories wizard or in Jira logs /application-logs/atlassian-jira.log
:
Error:
com.bigbrassband.jira.git.exceptions.repository.InvalidPrivateKeyException: Private SSH key is invalid or empty
at com.bigbrassband.jira.git.services.ssh.KeyManagerImpl.needPassphrase(KeyManagerImpl.java:103)
at com.bigbrassband.jira.git.rest.wizard.WizardResource.validateRepoOrigin(WizardResource.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
...
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.jcraft.jsch.JSchException: invalid privatekey: [C@17h421rm
at com.jcraft.jsch.KeyPair.load(KeyPair.java:664)
at com.bigbrassband.jira.git.services.ssh.KeyManagerImpl.needPassphrase(KeyManagerImpl.java:99)
... 264 more
Cause
Jira admin has provided an SSH public key or an SSH private key with an incorrect format.
Solutions
-
Create a new SSH key:
On Linux and macOS:
Use the following command to create a certificate:
ssh-keygen -t rsa -b 4096 -m pem -C [[email protected]](mailto:[email protected])
MacOS often incorrectly creates an OpenSSH format certificate. For more details, see information on this common problem.On Windows:
Download PuTTY and use PuTTYgen to generate an SSH key pair:
-
Set Type of key… to RSA.
-
Set Number of bits… to 4096.
-
Click Generate. Move mouse pointer on the blank area as instructed.
-
Follow screen instructions such as moving your mouse pointer on random locations on the blank area of the PuTTYgen dialog. Do this until the progress bar completely fills up and the SSH key pair is generated.
-
Entering a Passphrase for the generated key is optional but will ensure a more secure connection.
-
Save your generated public and private key to a file by clicking the respective options.
-
Copy the generated key. This is the public key that you will be using on the SSH configuration page of your git host.
-
For the private key, PuTTY creates a private key in its own “.ppk” format. Convert it to “.pem” via menu Conversions > Export OpenSSH key in PuTTYgen. Add/upload this file to Git Integration for Jira app > SSH Keys or when prompted on connecting SSH git repositories in Jira.
-
-
Create a new SSH key using RSA certificate format. See Solution #1.
-
Use OpenSSL PEM storage format. See Solution #1.
-
Provide the public SSH key to the SSH configuration of your git host.
-
Provide the private SSH key to the Git Integration for Jira app ➜ SSH Keys or when prompted on connecting SSH git repositories in Jira.
If you still have a question – reach out to our Support Desk or email us at [email protected].
More articles about troubleshooting, workarounds and solutions
Why I am getting the error, “git-upload-pack not permitted”?
Cannot auto-deploy some tracked repositories: Specified origin is incorrect or not supported
Connection Reset when Accessing the Database
“Dangerous use of multiple connections” error on local database
Duplicate entry 0 for key PRIMARY exceptions in log
Error while reindexing – Java heap space / Object too large, rejecting the pack
Error creating git branches and also using NFS
Fix performance issues for nested cloned repositories with enabled Git Service Permissions mode
Fixing reindex issues using Indexing Queue Viewer
Gitolite integration: Why the Git integration app not see the master branch?
Health Check: Database Collation
Indexing error – Too many open files
Installation fails when installing manually
Jira index error: IndexNotFoundException: no segments* file found
Malformed input or input contains unmappable characters
Personal access token failing Azure DevOps integration with Not Authorized error
Problems with shared home on Azure Storage
Pull request index error: org.json.JSONException
Repositories missing from Azure DevOps integration
“Service proxy has been destroyed” exceptions in log
SQLException ‘Incorrect string value’ in merge requests
SSH key file format is invalid (this page)
TFS – Not authorized exception when Jira works thru proxy
Unexpected exception parsing XML document from URL error in log
Why don’t I see the Create Branch or Pull Request features?
Your token has not been granted the required scopes
When a GIJ license expires, it shows up as a session error to the user