Jenkins 在 git 处挂起
Jenkins hangs at git fetch
我是 Jenkins 的新手,我正试图在 my.NET 项目中进行 运行 一些单元测试。
当我 运行 尝试从 git 存储库获取时,构建挂起。
错误:10 分钟后超时
C:\Program Files\Git\cmd\git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/name.of.repo
我已经生成了已知主机并将 .ssh 目录复制到 C:\Windows\SysWOW64\config\systemprofile.ssh,按照 "Jenkins, GIT plugin and Windows"
下 https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin 的 jenkins 说明
我从 cmd 行 运行 ssh git@github.com 我可以成功验证。
有什么想法吗?
谢谢:)
这可能是防火墙问题。
您可以使用 SSH(端口 22)向 Github 进行身份验证,以便该路由正常工作。
但是,您的工作是尝试通过超时的 https://github.com(端口 443)访问 github。
尝试通过 ssh 访问 github,方法是将存储库 url 更改为 git@github.com:account/repository.git
(您可以在存储库的主页上找到此 URL,下拉菜单 'Choose a clone URL',选项'SSH'.
我遇到了和楼主一样的问题。 SSH 凭据存储在 Jenkins 中,并适用于访问同一存储库的许多其他节点。我可以以 Jenkins 用户身份通过 ssh 进入机器,并使用与 Jenkins 作业 (git@git.com:account/repo.git
).
相同的 SSH 存储库 URL 在存储库上执行 git clone
作为解决方法,我暂时将 Jenkins 作业中的 git 凭据设置为 none
。我假设允许它使用本地存储的凭据。
现在正在运行。
在尝试使用 SSH 访问远程 Git 存储库而不是用户名和密码之前,您必须注意克隆和提取的超时设置。
当您的互联网连接不佳且远程存储库容量过大时会导致克隆超时。
进入项目设置:Source Code Management
-> Additional Behaviours
-> Advanced clone behaviours
-> Timeout (In Minutes) for clone and fetch operations
-> 10多分钟
然后,如果您仍然遇到 git 克隆卡住了很长时间的相同问题,无论是网络连接不良还是远程存储库过大,您可以尝试使用 SSH 来访问您的远程 Git 存储库而不是用户名和密码。
使用 SSH 的更简单替代方法是在 运行 任何 git
命令之前添加此代码段。
echo "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.intuit.com" >> /tmp/gitcredfile
git config --global credential.helper "store --file=/tmp/gitcredfile"
我是 Jenkins 的新手,我正试图在 my.NET 项目中进行 运行 一些单元测试。
当我 运行 尝试从 git 存储库获取时,构建挂起。
错误:10 分钟后超时
C:\Program Files\Git\cmd\git.exe config --local --remove-section credential # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://github.com/name.of.repo
我已经生成了已知主机并将 .ssh 目录复制到 C:\Windows\SysWOW64\config\systemprofile.ssh,按照 "Jenkins, GIT plugin and Windows"
下 https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin 的 jenkins 说明我从 cmd 行 运行 ssh git@github.com 我可以成功验证。
有什么想法吗?
谢谢:)
这可能是防火墙问题。
您可以使用 SSH(端口 22)向 Github 进行身份验证,以便该路由正常工作。
但是,您的工作是尝试通过超时的 https://github.com(端口 443)访问 github。
尝试通过 ssh 访问 github,方法是将存储库 url 更改为 git@github.com:account/repository.git
(您可以在存储库的主页上找到此 URL,下拉菜单 'Choose a clone URL',选项'SSH'.
我遇到了和楼主一样的问题。 SSH 凭据存储在 Jenkins 中,并适用于访问同一存储库的许多其他节点。我可以以 Jenkins 用户身份通过 ssh 进入机器,并使用与 Jenkins 作业 (git@git.com:account/repo.git
).
git clone
作为解决方法,我暂时将 Jenkins 作业中的 git 凭据设置为 none
。我假设允许它使用本地存储的凭据。
现在正在运行。
在尝试使用 SSH 访问远程 Git 存储库而不是用户名和密码之前,您必须注意克隆和提取的超时设置。
当您的互联网连接不佳且远程存储库容量过大时会导致克隆超时。
进入项目设置:Source Code Management
-> Additional Behaviours
-> Advanced clone behaviours
-> Timeout (In Minutes) for clone and fetch operations
-> 10多分钟
然后,如果您仍然遇到 git 克隆卡住了很长时间的相同问题,无论是网络连接不良还是远程存储库过大,您可以尝试使用 SSH 来访问您的远程 Git 存储库而不是用户名和密码。
使用 SSH 的更简单替代方法是在 运行 任何 git
命令之前添加此代码段。
echo "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.intuit.com" >> /tmp/gitcredfile
git config --global credential.helper "store --file=/tmp/gitcredfile"