如何使用部署密钥推送到受保护的github分支 [英] How can I push to protected github branches with a deploy key

查看:83
本文介绍了如何使用部署密钥推送到受保护的github分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经建立了github企业,我希望有一个travis构建将代码推回存储库,作为master分支构建的一部分.它基本上更新了更新日志,提交了文件并需要推回存储库.问题在于我们已经保护了分支,并尝试使用travis yields来设置部署密钥:

We have github enterprise set up at work and I want a travis build to push code back to the repo as part of the master branch build. It basically updates the changelog, commits the file and need to push back to the repo. The problem is that we have protected branches, and trying to push with the deploy key set up with travis yields:

remote: error: Required status check "continuous-integration/travis-ci" is expected.
At least one approved review is required.        
! [remote rejected]   master -> master (protected branch hook declined)

将保护分支设置为允许管理员覆盖无济于事,因为部署密钥不被视为管理员AFAIU.

It doesn't help that the protected branch is set up to allow admins to override, becuase the deploy key is not regarded as an admin AFAIU.

推荐答案

目前无法实现,我就此事与GitHub联系并获得了以下回复:

This is currently not possible, I reached out to GitHub about this and got the following response:

感谢您与我们联系!目前尚不可能,但是我很乐意将其作为功能要求传递给团队.我不能保证是否或何时将其实施,但是您的建议肯定在正确的手里!

Thanks for reaching out! That's not currently possible, but I would be happy to pass it along to the team as a feature request. I can't promise if or when it will be implemented, but your suggestion is definitely in the right hands!

同时,完成您所描述的唯一变通方法是不对管理员强制执行分支限制,而是使用计算机用户而不是部署密钥(并向该用户授予存储库的管理员权限):

In the meantime, the only workaround to accomplish what you're describing would be to not enforce branch restrictions for admins and use a machine user instead of a deploy key (and give that user Admin permissions to the repo):

https://developer.github.com/v3 /guides/managing-deploy-keys/#machine-users

这篇关于如何使用部署密钥推送到受保护的github分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆