git fetch --tags --progress 在 Jenkins 中超时,在命令行上工作正常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40855455/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git fetch --tags --progress times out in Jenkins, works fine on command line
提问by Departamento B
I've configured Jenkins to poll a Git repository, I'm using https not ssh. The following URL is configured, and I use a username and password.
我已将 Jenkins 配置为轮询 Git 存储库,我使用的是 https 而不是 ssh。配置了以下网址,我使用的是用户名和密码。
https://[email protected]:8443/scm/ourrepo/ourrepo-ios.git
When I run the build, it stalls for 10 minutes and times out. When I copy the line where it times out and paste it to command line on the same machine as Jenkins runs (a macOS server), it works:
当我运行构建时,它会停顿 10 分钟并超时。当我复制超时的行并将其粘贴到与 Jenkins 运行的同一台机器(macOS 服务器)上的命令行时,它可以工作:
git fetch --tags --progress https://[email protected]:8443/scm/ourrepo/ourrepo-ios.git +refs/heads/*:refs/remotes/origin/*
Why is it stuck for 10 minutes? I tried to use wrong credentials and that'll fail in a second. It's not a huge repo.
为什么会卡住10分钟?我试图使用错误的凭据,但很快就会失败。这不是一个巨大的回购。
The log:
日志:
Started by user Jenkins Admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/Build and test new commits on develop
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://[email protected]:8443/scm/ourrepo/ourrepo-ios.git # timeout=10
Fetching upstream changes from https://[email protected]:8443/scm/ourrepo/ourrepo-ios.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress https://[email protected]:8443/scm/ourrepo/ourrepo-ios.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://[email protected]:8443/scm/ourrepo/ourrepo-ios.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 fetch --tags --progress https://[email protected]:8443/scm/ourrepo/ourrepo-ios.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:315)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801)
... 11 more
ERROR: null
Finished: FAILURE
采纳答案by Ivan
Please check if user jenkins
exists on your OS and it has right permissions.
请检查jenkins
您的操作系统上是否存在用户并且它具有正确的权限。
How to set up jenkins
user on Mac OS X:
如何jenkins
在 Mac OS X 上设置用户:
- https://stackoverflow.com/a/24129589/5104202
- https://medium.com/@ved.pandey/setting-up-jenkins-on-mac-osx-50d8fe16df9f
- https://stackoverflow.com/a/24129589/5104202
- https://medium.com/@ved.pandey/setting-up-jenkins-on-mac-osx-50d8fe16df9f
EDIT
编辑
Please try this (I didn't test it):
请试试这个(我没有测试过):
Make the Jenkins user an admin:
sudo dseditgroup -o edit -a jenkins -t user admin
Add the Jenkins user to the developer group:
sudo dscl . append /Groups/_developer GroupMembership jenkins
Make the Jenkins user automatically login when the computer is restarted
使 Jenkins 用户成为管理员:
sudo dseditgroup -o edit -a jenkins -t user admin
将 Jenkins 用户添加到开发者组:
sudo dscl . append /Groups/_developer GroupMembership jenkins
使计算机重启时Jenkins用户自动登录