如何使用 Jenkins 在测试成功时推送到 Github?

How to use Jenkins to push to Github on test success?

我目前在 Git 上有一个 Python 项目。该仓库有 2 个不同的遥控器;一个叫 origin,另一个叫 github。有一个 Jenkins 作业在提交到 origin/master 时触发,它使用命令 nosetests-3.2 -v 运行单元测试。测试成功完成后,我希望 Jenkins 作业推送到 github/master。我尝试使用 GitPublisher post-build 操作,但出现以下错误:

ERROR: Publisher hudson.plugins.git.GitPublisher aborted due to exception
hudson.AbortException: No repository found for target repo name github
    at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:330)
    at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
    at hudson.model.Run.execute(Run.java:1766)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)

我做错了什么?这是我的 GitPublisher 配置的样子:

在答案中评论 copy/pasted 以便接受:

Remotes are not synced when you do a git push. Are you sure that the git repo that Jenkins is using has the github remote?