JGit "cannot open git-upload-pack" error message on bitbucket url with Java 6 Edited

Hi all,

I've been using bitbucket without problems for a couple of months now by using JRE 1.6. But, since last week, I can suddenly not "reach" to my repository URL from the JGit Java code.

I get the following error message:

org.eclipse.jgit.api.errors.TransportException: https://bitbucket.org/../xyz.git: cannot open git-upload-pack
at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:190)
at com.databorough.xinitializer.ui.git.GitHelper.isValidRemoteRepository(GitHelper.java:192)
at com.databorough.xinitializer.ui.git.GitHelper.isValidRepository(GitHelper.java:137)
at com.databorough.xinitializer.ui.git.GitHelper.main(GitHelper.java:609)
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
... 5 more
Caused by: java.lang.RuntimeException: Could not generate DH keypair
at com.sun.net.ssl.internal.ssl.DHCrypt.<init>(DHCrypt.java:114)
... 13 more
Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)
at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DashoA13*..)
at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:627)
at com.sun.net.ssl.internal.ssl.DHCrypt.<init>(DHCrypt.java:107)
... 20 more

The problem has apparently nothing to do with my Java code.

So I was wondering that the SSL problems could result a configuration change on the bitbucket web server side?

Kind regards,


3 answers

Not an answer I'm afraid but just adding that I can see the same error, in this case connecting from teamcity.  This suddenly happened last week.

I'll keep you posted if I find a solution but if anyone else can see this or has advice that would be useful.

So I did in the end upgrade to JDK 1.7, just took me a while to work out hwo to get Teamcity to use the newer version.  This resolved the problem.

So if you are just talking about JGit I would consider upgrading your Java verison on you machine.  1.7 is probably the bear minium nowdays anyway, but you should be able to go up to 1.8 without any problems.


Since last week we are experiencing the same problem. (using Eclipse with Java 6). We did not have any problems before that.

I haven't found any solution yet..

// björn


Hi again,

I found a solution where I changed my existing HTTPS-based transport to Bitbucket and using SSH-based instead. Works for me.


// björn

Thanks, but could you explain little bit, how your solution be implemented by JGit Java code?

We have also started facing the same issue since last few days. On investigation I found out that this occurs when the keysize sent by the Server to client is greater than 1024 . So does that mean there has been a change on bitbucket ?

We are currently on JDK 1.6 and unfortunately we cannot upgrade to a higher version of Java in near future. I have spent a lot of time looking at google and tried the following

1) Have used JCE unlimited strength provided by Oracle from here :


2)  Used bouncy castle as the JCE provider. This leads to another exception :

Caused by: java.lang.ArrayIndexOutOfBoundsException: 64
        at com.sun.crypto.provider.TlsPrfGenerator.expand(DashoA13*..)
        at com.sun.crypto.provider.TlsPrfGenerator.doPRF(DashoA13*..)
        at com.sun.crypto.provider.TlsPrfGenerator.doPRF(DashoA13*..)
        at com.sun.crypto.provider.TlsMasterSecretGenerator.engineGenerateKey(DashoA13*.


Can someone please help .


See my answer above. By switching to SSH-based authentication (rather than using HTTPS) we managed to stick with our Java 1.6 environment.

// björn

Hi björn,

Thanks for your reply. Can you please help me with how to use SSH instead of HTTPS from JGIT.


I dont know what develop environment you are using, but if it's Eclipse you first need to create your SSH key (Window->Preferences->General->Network Connections->SSH2). (this goes for Eclipse Kepler)

Create the new key (be sure to save it), and copy its public part and registrer it into Bitbucket -> user settings-> SSH keys.

Then you can clone your repo using the URI specified by bitbucket on the repo overview page (should be something like git@bitbucket.org:******/****.git

// björn

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,949 views 7 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you