我在詹金斯有一个Github Organisation
项目。在我的存储库的根目录中,我的Jenkinsfile
看起来像这样:
node {
def jenkinsCredsId = 'xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb'
stage 'Checkout'
checkout scm
// I also tried the following:
// checkout scm: [$class: 'GitSCM', source: 'ssh://git@github.com:MY_ORGANISATION/jenkins-testing-temp.git', clean: true, credentialsId: jenkinsCredsId]
stage 'Build'
// generate some artefact (dist.zip)
stage 'Release'
sshagent([jenkinsCredsId]) {
sh '''
git remote -v // show remotes
ssh-add -l // show currently loaded ssh keys fingerprints
git fetch --all --tags // IT FAILS HERE
CURRENT_BUILD_TAG="some_build/${BUILD_NUMBER}"
git tag ${CURRENT_BUILD_TAG}
git push --tags
github-release release \
--security-token ${GITHUB_RELEASE_TOKEN} \
--user MY_ORGANIZATION \
--repo MY_REPO \
--tag ${CURRENT_BUILD_TAG} \
--name ${CURRENT_BUILD_TAG}
github-release upload \
--security-token ${GITHUB_RELEASE_TOKEN} \
--user MY_ORGANIZATION \
--repo MY_REPO \
--tag ${CURRENT_BUILD_TAG} \
--name ${CURRENT_BUILD_TAG} \
--file dist.zip
'''
}
此处有一些用于测试存储库访问的行,它目前在git fetch
部分上失败,并出现以下错误:
致命:无法读取' https://github.com的用户名':没有此类设备或地址
来自上述git remote -v
的{{1}}命令输出类似Jenkinsfile
的内容。
我的origin https://github.com/MY_ORGANIZATION/MY_REPO
git配置如下所示:
我发现了一些相关的问题: