【问题标题】:git push sporadically fails on Jenkins with "Device not configured" errorgit push 在 Jenkins 上偶尔失败,出现“设备未配置”错误
【发布时间】:2016-07-05 12:41:59
【问题描述】:

我们正在使用Jenkins git plugin 在构建之前使用凭据克隆 git repo。

构建结束,如果成功,我们做git push:

BRANCH_TO_PUSH=${GIT_BRANCH/origin\//}
git push origin HEAD:refs/heads/${BRANCH_TO_PUSH}

偶尔,推送失败,输出如下:

fatal: could not read Username for 'https://git.example.net': Device not configured

如何解决这个问题?

【问题讨论】:

    标签: git jenkins


    【解决方案1】:

    当 repo 配置为通过 HTTPS 克隆时会出现此问题。 如果只是偶尔发生,则意味着 git 被配置为使用凭证助手在克隆时存储凭证。

    但是,by default the cache is set to 900 seconds (15 minutes)。如果您的构建时间超过此时间,则推送将失败。

    要将缓存 TTL 提高到 60 分钟,请在您的 Jenkins 机器上运行:

    sudo su - jenkins
    git config --global credential.helper 'cache --timeout=3600'
    

    【讨论】:

      猜你喜欢
      • 2018-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 2015-09-03
      • 2011-07-07
      • 1970-01-01
      相关资源
      最近更新 更多