我使用Capistrano v3和capistrano/symfony gem设置了以下部署脚本.我正在使用Ubuntu 14.4部署到AWS EC2实例我正在连接从AWS下载的.pem文件.我在deploy.rb中有以下内容
set :pty, true
set :ssh_options, {
user: 'ubuntu',
keys: ['/Users/myuser/Sites/Myproject.pem'],
forward_agent: true,
auth_methods: ["publickey"]
}
Run Code Online (Sandbox Code Playgroud)
部署时
bundle exec cap staging deploy --trace
Run Code Online (Sandbox Code Playgroud)
脚本连接正常,但失败了
INFO [4fd1b02c] Running /usr/bin/env git ls-remote --heads git@github.com:MyName/Myproject.git as ubuntu@ec2-00-000-000-000.eu-west-1.compute.amazonaws.com
DEBUG [4fd1b02c] Command: ( SYMFONY_ENV=prod GIT_ASKPASS=/bin/echo GIT_SSH=/var/www/tmp/myproject/git-ssh.sh /usr/bin/env git ls-remote --heads git@github.com:MyName/Myproject.git )
DEBUG [4fd1b02c] Permission denied (publickey).
DEBUG [4fd1b02c]
DEBUG [4fd1b02c] fatal: Could not read from remote repository.
DEBUG [4fd1b02c]
DEBUG [4fd1b02c]
DEBUG [4fd1b02c] Please make sure you have the correct …Run Code Online (Sandbox Code Playgroud) 我正在使用google api客户端获取博客文章列表(请参见以下代码)。
try {
// create service and get data
$blogger = new \Google_Service_Blogger($this->client);
// https://developers.google.com/blogger/docs/3.0/reference/posts/list
// GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts
if ($this->cache->contains('posts')) {
$posts = $this->cache->fetch('posts');
}
else {
$posts = $blogger->posts->listPosts($this->bloggerId, $optParams);
$this->cache->save('posts', $posts, 600); // 600 = 10 mins
}
return $posts;
} catch (apiServiceException $e) {
// Error from the API.
//print 'There was an API error : ' . $e->getCode() . ' : ' . $e->getMessage();
} catch (Exception $e) {
//print 'There was a general error …Run Code Online (Sandbox Code Playgroud)