0

我正在使用 Jenkins 2 并尝试使用 Build 部分中的“Execute Shell”执行以下 GIT 命令。

git config --global user.email $GITHUB_LOGIN git config --global user.name $GITHUB_LOGIN

git tag -a $BUILD_NUMBER -m "版本 $BUILD_NUMBER" git push origin --tags

有了这个,我在运行作业时遇到了错误

  • git push origin --tags fatal:无法读取“ https://github.com ”的用户名:设备未配置

在构建日志中,我观察到下面的声明,根据我的理解,我相信 Jenkins 正在使用 GIT_ASKPASS 从 GitHub 中提取更改。

使用 GIT_ASKPASS 设置凭据 GitHubCredentials

话虽如此,有人可以帮助我了解我是否可以使用“GIT_ASKPASS”来解决此问题吗?如果是,我该如何在我的情况下使用它?

4

1 回答 1

0

我用下面的代码片段解决了这个问题

git config --global user.name <git_username>

git push https://<git_username>:<git_password>@<git_repo_url>  --tags
于 2019-01-15T15:46:18.563 回答