Jenkins returned status code 128
Asked Answered
S

6

13

I am trying to setup Jenkins with BitBucket GIT repository, but the Jenkins console always gives me this error code:

Started by user Dakado
Building in workspace /var/lib/jenkins/workspace/TEST852
Fetching changes from the remote Git repository
Fetching upstream changes from git://bitbucket.org/GameTeamCZ/gtplaytime.git
FATAL: Failed to fetch from git://bitbucket.org/GameTeamCZ/gtplaytime.git
hudson.plugins.git.GitException: Failed to fetch from git://bitbucket.org/GameTeamCZ/    gtplaytime.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:625)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:847)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:872)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:651)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:560)
at hudson.model.Run.execute(Run.java:1670)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git://    bitbucket.org/GameTeamCZ/gtplaytime.git +refs/heads/*:refs/remotes/origin/*"     returned status code 128:
stdout: 
stderr: bitbucket.org[0: 131.103.20.167]: errno=Connection timed out
bitbucket.org[0: 131.103.20.168]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1148)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1018)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:74)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:207)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:623)
... 10 more

I have tried it many different ways but it always fails. Traffic on port 9418 is allowed on my server. Server is on 1 Gbps connection.

Subacute answered 11/2, 2014 at 23:21 Comment(2)
I have the same issue on my Jenkins instance on Docker. When I try to clone repo with the same SSH key from the same workspace in the terminal it works perfectly but running Jenkins job it trowing error Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress [email protected]:SomeName/repo-name.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:Mainland
Possible duplicate of Why is Jenkins failing when fetching from git, while the command line isn't?Tenon
I
4

This is worked for me: You need to create App Password on Bitbucket

(1) go to BitBucket Setting-> Access Manaegment-> App passwords-> Repositories (select options here whatever you want to accomplish)

(2) Jenkins -> Credentials-> Jenkins-> Global credentials (unrestricted) -> Add Credentials -> Kind "Username with password" provide here user/password here

(3) Go to your Jenkins Jobs -> GIT ->
Repository URL : https://[email protected]/ABCcompany/myRepo.git Credentials: select from dropdown You just created

Resources: Bitbucket, Jenkins, Selenium, Chrome

Ibsen answered 13/9, 2019 at 20:54 Comment(0)
W
3

Your issue is right here :

Fetching upstream changes from git://bitbucket.org/GameTeamCZ/gtplaytime.git
FATAL: Failed to fetch from git://bitbucket.org/GameTeamCZ/gtplaytime.git

Is your repository public or private ? If it is private, then there is 2 ways to connect to your Repo :

First using login/password

https://**login:password**@bitbucket.org/GameTeamCZ//gtplaytime.git

Second using CREDENTIALS Refer to that page to setup credentials for your Jenkins server : https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

Then you can use a command like that to login to your repository:

git@CREDENTIALS:TEAM/REPO.git
Wavelet answered 11/6, 2014 at 22:32 Comment(0)
S
2

So I have been struggling with this issue for months now. And after finding this thread, I finally got a successful pull and build.

My solution. I changed my settings from trying to pull with SSH and used what Mike ASP suggested. I used user name/pw as a global credentials.

There may have been a step missing on my configuration trying to pull using SSH. But the username and password works like a charm.

Skeg answered 16/9, 2021 at 16:29 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewNiall
C
2

Spent a full day and half a night trying to troubleshoot this issue. I am running Jenkins (version 2.346.1) on GKE and it's been doing great until this week when things went hay wire.

Context: In my case, it was not a timeout issue but rather it was returning:

The recommended git tool is: NONE
using credential 45f5d261-2a86-41be-9904-e2e04b0dd866
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress -- [email protected]:buymorepos/reports-api.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: No RSA host key is known for bitbucket.org and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The multibranch pipelines are using a private ssh key to access Bitbucket. After digging and Googling and finding this question, I decided to check:

Configure Global Security -> Git Host Key Verification Configuration -> Host Key Verification Strategy and found that it was set to "Known hosts file".

Changing it to "Accept first connection" resolved this issue for me.

Coleridge answered 25/8, 2022 at 4:25 Comment(0)
A
1

Increasing the clone time works for me. My clone was terminating as the file was too large and required more time to fetch the code from the repository and the default timeout is set at 10 minutes. Hence, increasing the limit from 10 to a larger time limit worked for me. Go to the job > Configure > Source Code Management > click on Add Additional Behaviours > select Advanced Clone Behaviour > set 'Timeout (in minutes) for clone and fetch operations' to 100. and check on Shallow Clone with depth 1. Check the attached image for more clarity here - JENKINS configuration for clone behaviour

Armandoarmature answered 23/9, 2020 at 10:50 Comment(0)
L
0

Jenkins returned status code 128 with Bitbucket

Failed to connect to repository : Command "git.exe ls-remote -h -- https://[email protected]/***-admin/automa.git HEAD" returned status code 128:stdout:stderr: fatal: Cannot prompt because user interactivity has been disabled.
remote: Invalid credentials
fatal: Authentication failed for 'https://bitbucket.org/****-admin/automa.git/'

I have tried a lot for this error and found a simple solution, jenkins will not connect with bitbucket with user name and password, we have to create APP password in bitbucket.

  1. Login to Bitbucket -> click on Settings gear -> click on Personal bitbucket settings
  2. Under Access Management click on App Passwords
  3. Click on Create password button and check read and write under repositories and click on Create button
  4. Copy the password and open jenkins project 5 under source code management section, click on git and add Repository URL
  5. Under credentials dropdown click on Add and select jenkins
  6. Under user name provide your bitbucket user name and past the password
Leporine answered 9/7, 2023 at 21:28 Comment(1)
How is this different from the existing Answers?Gallop

© 2022 - 2024 — McMap. All rights reserved.