gpt4 book ai didi

git fetch --tags --progress 在 Jenkins 中超时,在命令行上工作正常

转载 作者:太空狗 更新时间:2023-10-29 12:54:35 76 4
gpt4 key购买 nike

我已将 Jenkins 配置为轮询 Git 存储库,我使用的是 https 而不是 ssh。配置了以下 URL,我使用了用户名和密码。

https://myusername@stash.ourdomain.com:8443/scm/ourrepo/ourrepo-ios.git

当我运行构建时,它会停顿 10 分钟并超时。当我复制它超时的行并将其粘贴到运行 Jenkins 的同一台机器(macOS 服务器)上的命令行时,它起作用了:

git fetch --tags --progress https://myusername@stash.ourdomain.com:8443/scm/ourrepo/ourrepo-ios.git +refs/heads/*:refs/remotes/origin/*

为什么卡了10分钟?我试图使用错误的凭据,但很快就会失败。这不是一个巨大的 repo 协议(protocol)。


日志:

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://myusername@stash.ourdomain.com:8443/scm/ourrepo/ourrepo-ios.git # timeout=10
Fetching upstream changes from https://myusername@stash.ourdomain.com:8443/scm/ourrepo/ourrepo-ios.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress https://myusername@stash.ourdomain.com: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://myusername@stash.ourdomain.com: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://myusername@stash.ourdomain.com: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.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

最佳答案

请检查您的操作系统上是否存在用户 jenkins 以及它是否具有正确的权限。

如何在 Mac OS X 上设置 jenkins 用户:

编辑

请试试这个(我没有测试):

  • 让 Jenkins 用户成为管理员:sudo dseditgroup -o edit -a jenkins -t user admin

  • 将 Jenkins 用户添加到开发人员组:sudo dscl。追加/Groups/_developer GroupMembership jenkins

  • 让Jenkins用户在电脑重启时自动登录

关于git fetch --tags --progress 在 Jenkins 中超时,在命令行上工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40855455/

76 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com