Add secret environment variable to Travis CI

柔情痞子 提交于 2019-11-30 03:13:20

问题


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

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?

When I run the following command:

travis encrypt -r my_username/my_repo MY_SECRET_ENV=super_secret

I get the following error:

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

回答1:


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.



来源:https://stackoverflow.com/questions/12724139/add-secret-environment-variable-to-travis-ci

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!