Node.js 使用travis CI在GitHub中部署的权限被拒绝

Node.js 使用travis CI在GitHub中部署的权限被拒绝,node.js,github,ssh,continuous-integration,travis-ci,Node.js,Github,Ssh,Continuous Integration,Travis Ci,我正在做一个我想在GitHub页面上发布的项目。自动化我正在使用的部署过程。为此,我创建了一个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

我正在做一个我想在GitHub页面上发布的项目。自动化我正在使用的部署过程。为此,我创建了一个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 -
现在,当我将代码推送到master时,在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.

我遵循了其他类似错误的SO答案,也遵循了生成ssh密钥并将其添加到我的GitHub帐户,但没有成功。如果你能帮助我,我将不胜感激。谢谢。

如果您想通过ssh推送,travis需要访问您生成的ssh密钥的私有部分。您要做的是使用travis cli gem加密私钥,将其添加到repo中,并在部署阶段再次解密并使用它。
这里有一个

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

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.