【问题标题】:Permission Denied for deploying in GitHub using travis-CI使用 travis-CI 在 GitHub 中部署的权限被拒绝
【发布时间】:2018-12-28 22:54:01
【问题描述】:

我正在处理一个我想在 GitHub 页面中发布的项目。为了自动化部署过程,我使用了Travis CI。为此,我创建了一个 deploy.sh 文件,其中包含以下代码。

# build
npm run docs:build

# navigate into the build output directory
cd docs/.vuepress/dist

# if you are deploying to a custom domain
# echo 'www.example.com' > CNAME


git add -A
git commit -m 'deploy'

# if you are deploying to https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master

# if you are deploying to https://<USERNAME>.github.io/<REPO>
 git push -f git@github.com:<username>/<repo>.git master:gh-pages

cd -

我已将其添加到我的 .travis.yml 文件中,该文件位于以下

language: nodejs
node_js:
  - "lts/*"
before_script:
   - npm install
script:
 - bash ./scripts/deploy.sh

现在,当我将代码推送到主服务器时,在 travis-ci.org 中显示构建失败,输出如下,

Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The command "bash ./scripts/deploy.sh" exited with 128.

我已经关注了类似 link 的其他类似错误的 SO 答案,还关注了 the way 生成 ssh 密钥并将其添加到我的 GitHub 帐户,但没有成功。如果您能帮助我,我将不胜感激。谢谢。

【问题讨论】:

    标签: node.js github ssh continuous-integration travis-ci


    【解决方案1】:

    如果你想通过 ssh 推送,那么 travis 需要访问你生成的 ssh 密钥的私有部分。您要做的是使用 travis cli gem 加密私钥,将其添加到您的存储库中,并在部署阶段再次解密并使用它。 这是step-by-step

    【讨论】:

      猜你喜欢
      • 2016-11-08
      • 1970-01-01
      • 2017-06-22
      • 2014-01-03
      • 1970-01-01
      • 1970-01-01
      • 2013-12-09
      • 1970-01-01
      • 2014-04-18
      相关资源
      最近更新 更多