将秘密环境变量添加到 Travis CI [英] Add secret environment variable to Travis CI

查看:27
本文介绍了将秘密环境变量添加到 Travis CI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试向 Travis-CI 添加一个秘密环境变量.在文档中(安全环境变量")我发现了以下内容行做到这一点:

I'm currently trying to add a secret environment variable to Travis-CI. In the docs ("Secure environment variables") I found the following line to do this:

gem install travis
travis encrypt -r travis-ci/travis-core MY_SECRET_ENV=super_secret

如果我理解正确,我必须用我自己的存储库的名称替换 travis-ci/travis-core,因为加密应该只对我的存储库有效.因此,存储库中必须有公钥.是否有特殊的 travis 命令来添加此密钥?这究竟是如何工作的?或者这只是我的 ssh 公钥?

If I understood this correctly I must replace travis-ci/travis-core with the name of my own repository, because the encryption should only be valid for my repository. Therefore, there must be a public key in the repository. Is there a special travis command to add this key? How does this exactly work? Or is this just my ssh public key?

当我运行以下命令时:

travis encrypt -r my_username/my_repo MY_SECRET_ENV=super_secret

我收到以下错误:

There was an error while fetching public key, please check if you entered correct slug

推荐答案

这是一个已知问题.它已经有 GitHub 上的拉取请求来修复它.问题是获取存储库公钥的请求不起作用,因为他们将 API 更改为 SSL.如果您不想等待合并请求,您可以简单地更改源使用 https 而不是 http.

This is a known issue. It already has a pull request on GitHub to fix it. The problem is the request to get the public key of a repository does not work, because they changed the API to SSL. If you don't want to wait for the pull request to be merged, you can simply change the source to use https instead of http.

这篇关于将秘密环境变量添加到 Travis CI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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