explain:
During the work, Jenkins made such a mistake in pulling gitlab as below:
jenkenis ERROR: Error fetching remote repo ‘origin‘
The pipeline command is as follows:
pipeline {
agent any
options {
timeout(time: 2, unit: 'HOURS')
}
stages {
stage('Fetch code') {
steps {
echo 'Hello World'
checkout([$class: 'GitSCM', branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 1, noTags: true, reference: '', shallow: true, timeout: 120]],
submoduleCfg: [],userRemoteConfigs: [[credentialsId: '49352c9d-3f03-4271-8b60-2fddab3ca058', url:
'[email protected]']]])
}
}
}
}
Solution:
cd to the specified directory under the corresponding workspace, such as workspace\test_pipelinescript here, and manually clone the project to the local through git clone. It should be noted here:
1. Delete the .git folder in the test_pipelinescript directory;
2. Copy everything in the test_jenkins directory to test_pipelinescript
3. Restart Jenkins service.
Enter services.msc through Win + R, find Jenkins service and stop –> Start
4. Re-trigger Jenkins to execute again, and it’s OK.