试图使用Jenkins Pipeline

问题描述 投票:0回答:0
stage("Create New Release Branch") { sh 'chmod 777 -R ./jenkins-scripts' sh './jenkins-scripts/lock-branch.sh' }

Shell脚本(

lock-branch.sh

):
#!/usr/bin/env bash
    
git branch "release/R.$(date +%Y/%m/5d)"
sleep 5
git push -u origin "release/R.$(date +%Y/%m/%d)"
sleep 10
    
release_tag="release/R.$(date +%Y/%m/%d)"
echo $release_tag
sleep 5
    
git tag -a $release_tag
sleep 10
git push origin tag $release_tag

Jenkins日志错误:

[Pipeline] stage
[Pipeline] { (Create New Release Branch)
[Pipeline] sh
+ chmod 777 -R ./jenkins-scripts
[Pipeline] sh
+ ./jenkins-scripts/lock-branch.sh
fatal: could not read Username for 'https://github.company.com': No such device or address
release/R.2025/01/31

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'unknown@4b1399564e64.(none)')
error: src refspec refs/tags/release/R.2025/01/31 does not match any.
error: failed to push some refs to 'https://github.company.com/some-org/some-repo.git'
[Pipeline] }

	

Git告诉您有什么问题,您尚未设置您的用户。Email或user.name。它告诉您如何解决这个问题。我猜您通常在自己的用户ID下运行Git,但是Jenkins正在作为尚未设置的不同用户ID运行。在运行Jenkins的计算机上登录Jenkins的用户,将其从命令行中工作,然后您应该在Jenkins下工作。


bash shell github jenkins-pipeline
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.