从 Jenkins 作业中删除远程分支
·
问题:从 Jenkins 作业中删除远程分支
我在 Jenkins 中为我的 Git 存储库(Git on TFS online)进行了维护工作,以删除不符合特定条件或陈旧分支的分支。运行作业时它说:
Going to remove branch development/Batch_R7
fatal: InvalidOperationException encountered.
Showing a modal dialog box or form when the application is not running in
UserInteractive mode is not a valid operation. Specify the ServiceNotification
or DefaultDesktopOnly style to display a notification from a service
application.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://everisidbtfs.visualstudio.com': No
error
我从 Powershell 脚本运行此命令。
其他 Git 命令在该 Powershell 脚本中运行良好,例如获取分支列表。
如果我从 Jenkins 服务器(或任何其他机器)中的 Powershell 命令行运行 PowerShell 脚本,它可以正常工作。
TFS 用户有权删除遥控器,并向 Jenkins 作业提供凭据。
这是我用来删除分支的 Git 命令:
git push --porcelain --progress --recurse-submodules=check origin :refs/heads/<branch_name>
有什么解决方法吗?我究竟做错了什么?
我想到,由于 git 命令是“写入”操作(推送),可能 Jenkins 有一些安全限制来做到这一点......我在自动化脚本中使用的其余 git 命令是“只读的” .
解答
我想到的是,由于 git 命令是一个“写入”操作(推送),也许 Jenkins 有一些安全限制来做到这一点......
确切地说:所有其他操作都在 repo 本地,除了需要身份验证的推送操作。您需要确保在 Jenkins 中执行脚本的帐户具有正确的凭据。如果使用的 https URL 中没有身份验证信息,则意味着它应该依赖
-
凭证助手
-
或者,特定于 Jenkins,一个凭证插件
更多推荐
所有评论(0)