简体   繁体   中英

Unable to retrieve git submodule in jenkins with git-client plugin

I'm trying to have Jenkins retrieve the submodules of a repository, but I cannot get it to work. I've looked around on the internet for a solution, but most problems there center around authentication, which is not the issue in this case. From what I've been able to gather from the error message, the issue seems to be related to the way the git-client plugin handles reponses from the command-line tools.

As we had Git for Windows version 2.6.0 installed and the Jenkins Git-client plugin 'officially' supports version 2.5.0, I also tried uninstalling version 2.6.0 and installed version 2.5.0, but that made no difference.

Does anyone here have any experience with this problem or a possible solution? The error is:

FATAL: Command "c:\Program Files\Git\bin\git.exe submodule update" returned status code 1:
stdout: 
stderr: Cloning into 'mysubmodule'...
error: cannot spawn echo : No such file or directory
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'http://somerepo': No error
Clone of 'http://somerepo/scm/bf/mysubmodule.git' into submodule path 'mysubmodule' failed

I have experienced the very same error, with same version of Git and Jenkins Git-client plugin. It appears that this could be a combination of a bug and a misconfiguration of the submodule(s) in the .gitmodules file of the main repository. And the error message is definitely not as helpful as it could be!

In my case the .gitmodules file in the main repository contained the absolute url path to the submodule. This caused Jenkins to not be able to authenticate properly for the submodule. Changing the submodule path to be relative (../mysub.git) fixed it for me.

This helped me quite a lot: https://issues.jenkins-ci.org/browse/JENKINS-31244

I hope you find this helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM