我在 Bluemix 中有一个构建和部署管道,如果该阶段已成功部署,我想标记 git。 目前,我在部署阶段之后添加了一个构建步骤,其中的 shell 脚本如下所示:
# put the git tag
echo 'Put tag build_$BUILD_NUMBER on git'
git tag build_$BUILD_NUMBER
git push --tags
返回的错误是:
fatal: could not read Username for 'https://hub.jazz.net': No such device or address Build step 'Execute shell' marked build as failure
但是我似乎没有.gitcredentials 文件可以推送而不需要添加身份验证信息。
如何将 git 上的标签推送到我的交付管道中?
最佳答案
您需要输入远程 URL 的用户名和密码。我过去测试过以下内容并且对我有用:
git remote set-url origin https://$USERNAME:$PASSWORD@hub.jazz.net/git/user/project
其中 USERNAME 和 PASSWORD 是舞台上的环境属性。我建议将密码设置为安全属性,这样该值就不会显示在日志中。之后您应该能够推送您的标签。
关于git - 蓝调 : How I can configure a delivery pipeline stage build to tag git?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33846388/