【问题标题】:SCM Checkout: Git no credentials specified errorSCM Checkout:Git 没有指定凭据错误
【发布时间】:2020-07-17 05:26:57
【问题描述】:

我正在尝试通过在 Git 上托管代码来运行 Python,但出现以下错误:

[Pipeline] stage [Pipeline] { (SCM checkout) [Pipeline] git No 指定凭据

C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10 从远程 Git 存储库获取更改

这是我完整的 jenkis 文件:

node {
    stage ('SCM checkout'){
        git "https://github.com/hiraxwahid/pytest/"
        }
    stage('build') {
        sh 'pip install -r requirements.txt'
    }
    stage('test') {
        sh 'python Tests.py'
    }
}

我也尝试在管道配置中保存凭据,但也无济于事。

【问题讨论】:

    标签: git jenkins jenkins-plugins


    【解决方案1】:

    如果它与块一起关闭回购,请指定凭据

    withCredentials([sshUserPrivateKey(credentialsId: 'CREDE_ID_HERE', passphraseVariable: '', usernameVariable: '')]) {
        // some block
    }
    

    【讨论】:

    • 如何创建凭证 ID?你有什么推荐的插件吗?
    • 您将使用 jenkins 实例中的管道语法生成器获得准确的 SCM checkout 管道代码。我看到您也没有执行git clone,建议为SCM checkout 阶段自动生成脚本,而不是自己输入。
    • 要将凭据存储在 jenkins 中,您需要安装“凭据插件”。在“管理詹金斯”菜单中找到“管理凭据”之后。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 2020-03-08
    • 2019-12-02
    • 2016-11-22
    • 1970-01-01
    • 2014-01-31
    • 2015-01-02
    相关资源
    最近更新 更多