试图从travis-ci部署到gh页面
问题描述:
我正在尝试遵循this指令集。试图从travis-ci部署到gh页面
我的travis日志是here。
0.01s$ openssl aes-256-cbc -K $encrypted_4b2755af321b_key -iv $encrypted_4b2755af321b_iv -in etc/deploy.enc -out ~/.ssh/publish-key -d
before_install.2
0.00s$ chmod u=rw,og= ~/.ssh/publish-key
before_install.3
0.00s$ echo "Host github.com" >> ~/.ssh/config
before_install.4
0.00s$ echo " IdentityFile ~/.ssh/publish-key" >> ~/.ssh/config
before_install.5
0.00s$ git --version
git version 1.8.5.6
before_install.6
0.01s$ git remote set-url origin [email protected]:zaun/riot-ui.git
$ git fetch origin -f gh-pages:gh-pages
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
Enter passphrase for key '/home/travis/.ssh/publish-key':
Done: Job Cancelled
该作业挂起/home/travis/.ssh/publish-key
。密钥没有密码。击中Enter
会使脚本继续。
我before_install
步处理,关键是这样的:
before_install:
- openssl aes-256-cbc -K $encrypted_4b2755af321b_key -iv $encrypted_4b2755af321b_iv -in etc/deploy.enc -out ~/.ssh/publish-key -d
- chmod u=rw,og= ~/.ssh/publish-key
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- echo "Host github.com" >> ~/.ssh/config
- echo " IdentityFile ~/.ssh/publish-key" >> ~/.ssh/config
- git --version
- git remote set-url origin [email protected]:zaun/riot-ui.git
- git fetch origin -f gh-pages:gh-pages
我在做什么错?我如何得到这个工作?
答
尝试使用ssh代理。
addons:
ssh_known_hosts: github.com
before_script:
- openssl aes-256-cbc -K $encrypted_4b2755af321b_key -iv $encrypted_4b2755af321b_iv -in etc/deploy.enc -out publish-key -d
- chmod 600 publish-key
- eval `ssh-agent -s`
- ssh-add publish-key
而且尽可能晚地执行此操作可能会更安全,以避免第三方脚本公开您的密钥。我个人在使用git命令之前,在我的after_success
脚本中执行此操作。
您可以看看this repository的完整示例。
答
如果git
等待输入,你可以尝试喂养它一个新行:
before_install:
⋮
- echo | git fetch origin -f gh-pages:gh-pages