Jenkins build process fails with the following GIT error. And this seems to fail only for this GitHub Enterprise repository. If I try to do the same for GitHub repository, all ends well.
Building in workspace D:\Program Files(x86)\Jenkins\workspace\pullcodefromgithub
Cloning the remote Git repository
Cloning repository https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe init D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
ERROR: null
Finished: FAILURE
Note: This is not gitHub, but GitHub enterprise. Not sure how to fix it. No matter where I try - Mac or Windows, error is the same. Tried the same with SSH and that also fails
Started by user Ram
Building in workspace D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://githubenterprise.grangeinsurance.com/hmb/sail-server.git # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801)
... 11 more
ERROR: null
Finished: FAILURE
If I try to pull the contents of the repository from terminal or command prompt or git shell, it seems to work without any issues.
I am clueless to what is going on here. Any help or advice would be greatly helpful.
Thanks
This issue happens because of jenkins using "git" in stead of "jgit". This change will bring the universe back to sanity. Here's how we do it
Manage Jenkins-> Global configuration tool
Proceed to "git" section and Tap on "Add Git" drop down button, select JGit
Save your changes
Manage Jenkins -> Browse into your project/item -> Configure
Go into the repository configuration section
Git executable - change from default to jgit
Save your changes and proceed to build
This time, build should succeed. Happy building.
Related
a few of us use a bare repository on a network share ( u:\data\some_repo.git) and this works fine with the expected limitations
However, just recently I have been unable to perform any typical git activities associated with the bare respository: push pull clone.
All activities fail with:
fatal: 'u:\data\some_repo.git' does not appear to be a
git repository fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
I do have access and I can browse this location fine. If I copy some_repo.git to my local machine and do a git clone /c/Temp/some_repo.git it works.
There is no latency issue, I have full access, I have tried prepending file:/// with no luck. a GIT_TRACE does not show anything
GIT_TRACE=1 git clone "/u/data/some_repo.git" 12:52:37.433340
exec-cmd.c:237 trace: resolved executable dir:
C:/STORAGE/Application/Git/mingw64/bin 12:52:37.435332 git.c:444
trace: built-in: git clone u:/data/some_repo.git Cloning into
'InternalTestInterface'... 12:52:38.129124 run-command.c:663
trace: run_command: unset GIT_DIR; 'git-upload-pack
'''u:/data/some_repo.git'''' 12:52:38.370091 exec-cmd.c:237
trace: resolved executable dir:
C:/STORAGE/Application/Git/mingw64/libexec/git-core 12:52:38.370091
git.c:444 trace: built-in: git upload-pack
u:/data/some_repo.git fatal: 'Hu:/data/some_repo.git' does not appear
to be a git repository fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
Any idea how to resolve this
--update--
as requested, attempting to perform a git init:
/u/data/test.git
$ git init error: fstat on
//FQDN.com/site_###/Groups/data/test.git/.git/config failed: Invalid
argument fatal: could not set 'core.filemode' to 'false'
I have the exact same setup at work, with the same network drive (also named U:\!)
And I had the same issue at some point, apparently due to some background synchronisation/backup process which was keeping an handle on some of the files of the Git bare repository.
Try first to see if you can re-create a separate bare repo, for testing, and push to it:
git init U:\data\test.git
cd path\to\local\repo
git remote add origin2 U:\data\test.git
git push origin2 master
I have a maven multi modules project.
I create a pipeline to clean and deploy my project.
When I run the pipeline I got the following output :
``Started by user XXXXX
Checking out git http://XXXX:9080/gara/gara-back-end.git into /var/jenkins_home/workspace/gara-bo#script to read Jenkinsfile
using credential XXXXXXXXXXX
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://XXXXXXX:9080/gara/gara-back-end.git # timeout=10
Fetching upstream changes from http://XXXXX:9080/gara/gara-back-end.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --force --progress http://XXXXXX:9080/gara/gara-back-end.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision c717022003b698421698238b13e1909f555172a0 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f XXXXXXXXXXXXXXX
Commit message: "Update Jenkinsfile"
> git rev-list --no-walk 7XXXXXXXXXXXXXXXXXXXXXXX # timeout=10
ERROR: /var/jenkins_home/workspace/gara-bo#script/Jenkinsfile not found
Finished: FAILURE``
Why the project is checked out under gara-bo#script instead of gara-bo ?
On the server, I have two folders : gara-bo and gara-bo#script
``gara-bo contains : Jenkinsfile pom.xml src target WEB-INF
gara-bo#script : gara-common gara-dao gara-model gara-service gara-web JenkinsFile pom.xml``
but file in the gara-bo#script are just symbolic link because when I try to read the content of JenkinsFile under gara-bo#script it is impossible.
Do you know, how could I correct it please ?
That is because there are many other branches which didn’t contain a Jenkins file yet.
Probably it it the first time you are using Jenkins. So the Jenkins file in only in your current developing branch (E.g: YOUR_BRANCH-79).
Here don't use :origin/YOUR_BRANCH-.*, you can use :origin/YOUR_BRANCH-79.
When I create the Jenkinsfile, i Add a space in the name. So please check that the name doesn't contain a space. You have to have "Jenkinsfile", not " Jenkinsfile" or "Jenkinsfile ", etc...
Getting the following error while trying to build:
Building in workspace F:\BuildSource\SeleniumHTTPMonitoring
> F:\soft\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> F:\soft\Git\bin\git.exe config remote.origin.url https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git # timeout=10
Fetching upstream changes from https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git
> F:\soft\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
> F:\soft\Git\bin\git.exe config --local credential.username master.builder # timeout=10
> F:\soft\Git\bin\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git1527457549107748901.credentials\" # timeout=10
> F:\soft\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git +refs/heads/*:refs/remotes/origin/*
> F:\soft\Git\bin\git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing git command
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1751)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1476)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:797)
... 11 more
Caused by: org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201
at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126)
at org.jvnet.winp.WinProcess.getCommandLine(WinProcess.java:102)
at hudson.util.ProcessTree$Windows$1.getArguments(ProcessTree.java:441)
at hudson.plugins.msbuild.MsBuildKillingVeto.vetoProcessKilling(MsBuildKillingVeto.java:55)
at hudson.util.ProcessTree$OSProcess.getVeto(ProcessTree.java:239)
at hudson.util.ProcessTree$Windows$1.killRecursively(ProcessTree.java:422)
at hudson.util.ProcessTree.killAll(ProcessTree.java:142)
at hudson.Proc$LocalProc.destroy(Proc.java:375)
at hudson.Proc$LocalProc.join(Proc.java:348)
at hudson.Proc.joinWithTimeout(Proc.java:164)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1736)
... 15 more
ERROR: null
Jenkins 2.7.1 is running on Windows Server 2012 R2 (the same error was occurring on Jenkins 2.7.4). I can clone the repo via git command line without any problems. When this happens I can see multiple git processes trees in task manager Screenshot and if I wait for a while I will see this in Jenkins.
The culprit was Git plugin. It started working after update.
I was using 2.5.3 version.
I installed jenkins uploading the jenkins.war to my tomcat, in windows, and installed it the git plugin, I did all the procedures for the ssh key and I have been able to succesfully push and pull to my git repo in bitbucket from the cmd, but I haven't still been able to do it from jenkins, here are the weird stuff that happened to me:
I can do push and pull and execute anything from git batch but to be able to do the same from the cmd I have to open it as administrator.
The eval command doesn't work from the cmd.
I get the "returned status code 128:" exception mentioned on the jenkins git plugin installation for windows manual, but instead of getting the "fatal: The remote end hung up unexpectedly" error I get "E:\Tomcat not recognized as an internal or external command"
Here's the exception:
Fetching upstream changes from git#bitbucket.org:mycompany/myrepo.git
> C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
using GIT_SSH to set credentials SRVSYMPHONY SSH
> C:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress git#bitbucket.org:mycompany/myrepo.git +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from git#bitbucket.org:mycompany/myrepo.git
hudson.plugins.git.GitException: Failed to fetch from git#bitbucket.org:mycompany/myrepo.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:627)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:865)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:890)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1255)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
at hudson.model.Run.execute(Run.java:1740)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:233)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress git#bitbucket.org:mycompany/myrepo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: "E:\Tomcat" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
fatal: Could not read from remote repository.
Do you know whats happening to me?
Thanks
In order to be able to connect to my private repo in bitbicket I had to add the password to the url this way:
https://<user>:<pass>#bitbucket.org/<user>/<project>.git
The answer was in this question:
Using Jenkins with a private BitBucket Git repository
Thanks
I need some help with an authentication issue I have encountered with Github/Jenkins.
Setup is as follows:
Jenkins master is on windows
Slave is running on OSX
Jenkins can communicate fine with the slave
When trying to pull from our private git repo we see the following error, this error is not on either the master or other linux slaves and clones fine in OSX terminal.
Started by user xxxxxxxxxxxx
[EnvInject] - Loading node environment variables.
Building remotely on MAC01 in workspace /var/jenkins/workspace/xxxxxxxxxxxx
Checkout:NativeiOSSlots / /var/jenkins/workspace/xxxxxxxxxxxxx - hudson.remoting.Channel#166d8eb:MAC01
Using strategy: Default
Last Built Revision: Revision 7232678c31bf2c6f3c4bd5a66b349edf9288440c (origin/HEAD, origin/master)
Cloning the remote Git repository
Cloning repository <repo url>
git --version
git version 1.8.3.1
ERROR: Error cloning remote repo 'origin' : Could not clone <repo url>
hudson.plugins.git.GitException: Could not clone <repo url>
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:226)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:57)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:33)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2387)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: hudson.plugins.git.GitException: Command "/Applications/GitHub.app/Contents/Resources/git/bin/git clone --progress -o origin <repo url> /var/jenkins/workspace/xxxxxxxxxx" returned status code 128:
stdout: Cloning into '/var/jenkins/workspace/xxxxxxxxxx'...
stderr: remote: Repository not found.
fatal: Authentication failed for '<repo url>'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:790)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$100(CliGitAPIImpl.java:33)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:224)
... 14 more
Any Ideas?
I was facing same problem. Jenkin was not able to clone my git repo to local PC.
Solution:
Start services.msc
goto Jenkins service and open it's property
goto Logon tab and and give your a/c userName and password.
restart the service.
These steps solved my problem, as I have given my enterprise login and password in there.
Most likely the user that the Jenkins slave runs as on your Mac isn't properly set up for github (doesn't have the proper certificate). On my Mac slave that's the user named jenkins. Log in as that user on your slave and see if you can do:
ssh -T git#github.com
If that's not working, make sure you have the proper certificate installed and that the machine can see the outside world.
Does it really clone fine from the terminal when run as the user running jenkins ?
You probably haven't set up your SSH access properly. See this: Could not clone repository
I also had this issue. I ended up having to downgrade my Git Client plugin to 1.6.4. When I was running 1.8.0 I got this error for every repo I tried to clone. As soon as I rolled it back, it all started to work.