未指定凭据正在从远程获取更改 Git
No credentials specified Fetching changes from the remote Git
我正在尝试完成我的第一份 Jenkins 工作。我想 运行 上传到 git 的 java 项目,但在构建作业时出现此错误:
No credentials specified Fetching changes from the remote Git
repository ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from
https://gitlab/engineering/automation/create_pass_criteria.git at
hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:908) at
hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1123) at
hudson.plugins.git.GitSCM.checkout(GitSCM.java:1159) at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
at
org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
at
org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=12=](SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) at java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
hudson.plugins.git.GitException: Command "git fetch --tags --progress
https://gitlab/engineering/automation/create_pass_criteria.git
+refs/heads/:refs/remotes/origin/" returned status code 128: stdout: stderr: fatal: unable to access
'https://gitlab/engineering/automation/create_pass_criteria.git/':
Peer's certificate issuer has been marked as not trusted by the user.
这是我的 groovy 詹金斯文件:
#!groovy
pipeline {
agent { node { label "agent_314" } }
stages {
stage("Build") {
steps {
echo "Building..."
git 'https://gitlab/engineering/automation/create_pass_criteria.git'
sh './mvnw clean compile'
}
}
}
}
在 Jenkins 中为您的 git 存储库添加凭据,然后在管道中为 git checkout
提供凭据
要添加凭据 -
詹金斯 -> 管理詹金斯 -> 管理凭证
在 Stores scoped to Jenkins 下,点击 Jenkins 然后点击 Global Credentials (unrestricted) 。
从左侧单击添加凭据并为您的 git 存储库定义用户名和密码并记下凭据 ID
在您的 jenkins 文件中添加以下行
git credentialsId: 'your git credentials ID', url: 'https://gitlab/engineering/automation/create_pass_criteria.git'
更多信息可以参考here
我正在尝试完成我的第一份 Jenkins 工作。我想 运行 上传到 git 的 java 项目,但在构建作业时出现此错误:
No credentials specified Fetching changes from the remote Git repository ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://gitlab/engineering/automation/create_pass_criteria.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:908) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1123) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1159) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start[=12=](SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://gitlab/engineering/automation/create_pass_criteria.git +refs/heads/:refs/remotes/origin/" returned status code 128: stdout: stderr: fatal: unable to access 'https://gitlab/engineering/automation/create_pass_criteria.git/': Peer's certificate issuer has been marked as not trusted by the user.
这是我的 groovy 詹金斯文件:
#!groovy
pipeline {
agent { node { label "agent_314" } }
stages {
stage("Build") {
steps {
echo "Building..."
git 'https://gitlab/engineering/automation/create_pass_criteria.git'
sh './mvnw clean compile'
}
}
}
}
在 Jenkins 中为您的 git 存储库添加凭据,然后在管道中为 git checkout
提供凭据要添加凭据 - 詹金斯 -> 管理詹金斯 -> 管理凭证 在 Stores scoped to Jenkins 下,点击 Jenkins 然后点击 Global Credentials (unrestricted) 。
从左侧单击添加凭据并为您的 git 存储库定义用户名和密码并记下凭据 ID
在您的 jenkins 文件中添加以下行
git credentialsId: 'your git credentials ID', url: 'https://gitlab/engineering/automation/create_pass_criteria.git'
更多信息可以参考here