Issue while integrating Jenkins with bitbucket

147 views
Skip to first unread message

swathi mudumbai

unread,
Apr 10, 2020, 4:27:35 PM4/10/20
to Jenkins Users
Hi

I am new to Jenkins and Bitbucket. I have a repos on remote bitbucket cloud. I am trying to integrate that with Jenkins.
I have Jenkins installed on my personal laptop  in my home network. 
I generated the SSH keys on my local pc (where the Jenkins is installed) cmd prompt  and configured the SSH keys (private in Jenkins) and public in my bitbucket repos.
Also I installed bitbucket plugin and webhook on Jenkins.
When I tried to create a new Item (proj) on Jenkins and entered the URL of  my bitbucket repos (SSH URL), it failed  and I get the following error:
Can anyone please help me to resolve this issue.


 A problem occurred while processing the request. Please check our bug tracker to see if a similar problem has already been reported. If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem. If you think this is a new issue, please file a new issue. When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins. The users list might be also useful in understanding what has happened.
Stack trace
java.lang.RuntimeException: ssh executable not found. The git plugin only supports official git client http://git-scm.com/download/win
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getSSHExecutable(CliGitAPIImpl.java:2299)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createWindowsGitSSH(CliGitAPIImpl.java:2305)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1982)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1944)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1935)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:3295)
at hudson.plugins.git.UserRemoteConfig$DescriptorImpl.doCheckUrl(UserRemoteConfig.java:209)
at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77)
at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
Caused: javax.servlet.ServletException


Thanks
Swathi

Mark Waite

unread,
Apr 10, 2020, 4:33:57 PM4/10/20
to Jenkins Users


On Friday, April 10, 2020 at 2:27:35 PM UTC-6, swathi mudumbai wrote:
Hi

I am new to Jenkins and Bitbucket. I have a repos on remote bitbucket cloud. I am trying to integrate that with Jenkins.
I have Jenkins installed on my personal laptop  in my home network. 
I generated the SSH keys on my local pc (where the Jenkins is installed) cmd prompt  and configured the SSH keys (private in Jenkins) and public in my bitbucket repos.
Also I installed bitbucket plugin and webhook on Jenkins.
When I tried to create a new Item (proj) on Jenkins and entered the URL of  my bitbucket repos (SSH URL), it failed  and I get the following error:
Can anyone please help me to resolve this issue.


 A problem occurred while processing the request. Please check our bug tracker to see if a similar problem has already been reported. If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem. If you think this is a new issue, please file a new issue. When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins. The users list might be also useful in understanding what has happened.
Stack trace
java.lang.RuntimeException: ssh executable not found. The git plugin only supports official git client http://git-scm.com/download/win

Command line git uses command line ssh to fetch remote repositories that use ssh protocol.  The Jenkins process that is trying to detect the tip of the branch on the remote (Bitbucket) repository can't find an executable named 'ssh.exe' in the Windows path of the Jenkins process.

That probably means that your installation of command line git is not visible to the Jenkins process.  The Jenkins "Manage Jenkins" page includes a "System Information" page that lists the environment variables known to Jenkins.  Check that list to confirm that command line git and command line ssh can be found in the Windows PATH that Jenkins is using.

It might also mean that you've configured command line git or your Windows environment in some unexpected manner.  That is less typical, but also possible.

Mark Waite

swathi mudumbai

unread,
Apr 10, 2020, 6:03:16 PM4/10/20
to Jenkins Users
Hi Mark

Thanks a lot for your quick reply. 

FYI I am not using the Command line GIT. I am using sourcetree GUI as GIT client on my Windows 10 laptop. And the GIT master is a remote bitbucket cloud repos.

The error message that I got did not make much sense to me. Can you please help me to understand it.


Thanks
Swathi

Mark Waite

unread,
Apr 10, 2020, 6:06:44 PM4/10/20
to Jenkins Users
On Fri, Apr 10, 2020 at 4:03 PM swathi mudumbai <swathi....@gmail.com> wrote:
Hi Mark

Thanks a lot for your quick reply. 

FYI I am not using the Command line GIT. I am using sourcetree GUI as GIT client on my Windows 10 laptop. And the GIT master is a remote bitbucket cloud repos.


The Jenkins git plugin is not tested with SourceTree GUI as its git provider.  If you want to use the Jenkins git plugin, you'll need to install Git for Windows.  I prefer the "Portable Edition" because it does not require elevated privileges to install it and you can place it anywhere that makes sense to you.  https://git-scm.com/download/win is the download location.

Mark Watei
 
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d4ed80f8-bb61-4065-8070-81d3df63b57b%40googlegroups.com.

swathi mudumbai

unread,
Apr 10, 2020, 10:06:20 PM4/10/20
to Jenkins Users
Thanks a lot for your suggestion. I will try downloading the git  client for windows.

So that means having bitbucket plugin in Jenkins alone won't work right?

Thanks
Swathi
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

Mark Waite

unread,
Apr 10, 2020, 10:46:57 PM4/10/20
to Jenkins Users
The Bitbucket plugin depends on the git plugin and uses some of its functionality to do Bitbucket work.  If you installed the Bitbucket plugin, then Jenkins included the git plugin dependency automatically.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e53ae672-59c2-44cf-b112-19bb0e14d121%40googlegroups.com.

swathi mudumbai

unread,
Apr 11, 2020, 8:13:50 PM4/11/20
to Jenkins Users
Yes, Jenkins already has git plugin installed. So right now, Jenkins in my system has both bitbucket and git plugins. 

Regarding the orginal issue, I even tried with git windows client  (http://git-scm.com/download/win) instead of source tree GUI client on my pc. 

With git windows client, I tried to generate the ssh keys and configured them in bit bucket and Jenkins.

With this git client, I am getting only read only privileges to my remote bitbucket cloud repos. And also,  the orginal issue of getting the "ssh.exe not found error"  still persists when  I am trying to put the SSH URL  of by bitbucket repos into the Jenkins.

Thanks
Swathi

Mark Waite

unread,
Apr 11, 2020, 8:40:47 PM4/11/20
to Jenkins Users
On Sat, Apr 11, 2020 at 6:14 PM swathi mudumbai <swathi....@gmail.com> wrote:
Yes, Jenkins already has git plugin installed. So right now, Jenkins in my system has both bitbucket and git plugins. 

Regarding the orginal issue, I even tried with git windows client  (http://git-scm.com/download/win) instead of source tree GUI client on my pc. 

With git windows client, I tried to generate the ssh keys and configured them in bit bucket and Jenkins.

With this git client, I am getting only read only privileges to my remote bitbucket cloud repos. And also,  the orginal issue of getting the "ssh.exe not found error"  still persists when  I am trying to put the SSH URL  of by bitbucket repos into the Jenkins.

If the original issue still persists, then you may have missed my earlier instructions.  I said:

The Jenkins "Manage Jenkins" page includes a "System Information" page that lists the environment variables known to Jenkins.  Check that list to confirm that command line git and command line ssh can be found in the Windows PATH that Jenkins is using.

If Jenkins cannot find the ssh.exe program, the command line git most likely won't be able to find the ssh.exe program when command line git is called from Jenkins.

 
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7531b889-c258-4472-8ed0-9bfaeaff04b7%40googlegroups.com.

swathi mudumbai

unread,
Apr 12, 2020, 1:24:37 PM4/12/20
to jenkins...@googlegroups.com
Hi Mark

Thanks again for your reply.  An improvement over last time is that I am able to configure the SSH keys and connect the git client (Git Bash) and bitbucket correctly and was able to commit and push the changes made within my windows git client to remote bitbucket repos without any issue. 

But when integrating the bitbucket with Jenkins, when I type in the SSH URL of my bitbucket repos I still get an error as follows:
(As I mentioned, I entered the SSH private key generated through my git client on my windows pc in Jenkins and the publick key in the bitbucket.)

image.png


I checked the windows PATH in Jenkins Environment Variable as you suggested, this is how it looks like:

image.png

Below is what my windows pc environmental variables PATH have:
image.png


Can you please suggest what is missing here.

Thanks
Swathi



Mark Waite

unread,
Apr 12, 2020, 2:48:59 PM4/12/20
to Jenkins Users
I would guess that the message "invalid format" might indicate one of the following:
  • Copy and paste error in the private key that you defined in the Jenkins credential.  Note that it must be a private key credential, not a username / password credential
  • Public key was entered into the Jenkins credential instead of entering the private key in the Jenkins credential 
  • Private key type that was entered into the Jenkins credential is not understood by the command line git version that you installed.  Assuming you installed command line git 2.26.0, this should not be a risk, since command line git 2.26.0 (and many versions before) deliver a version of OpenSSH that is quite recent (Thanks to Johannes Schindlein for keeping Git for Windows current).  For example, I regularly use RSA private keys and ED25519 private keys with Git for Windows.  I don't often use ECDSA private keys, but have no reason to believe they would have any issue

Reply all
Reply to author
Forward
0 new messages