首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用飞行计划部署时出现连接错误

使用飞行计划部署时出现连接错误
EN

Stack Overflow用户
提问于 2015-05-04 20:23:22
回答 1查看 778关注 0票数 1

我正在使用flightplan运行这段代码:

代码语言:javascript
复制
var plan = require('flightplan');

var appName = 'personal-website';
var username = 'deploy';
var startFile = 'bin/www';

var tmpDir = appName+'-' + new Date().getTime();

// configuration
plan.target('staging', [
  {
    host: '104.131.153.117',
    username: username,
  }
]);

plan.target('production', [
  {
    host: '104.131.153.117',
    username: username,
  },
//add in another server if you have more than one
// {
//   host: '104.131.93.216',
//   username: username,
//   agent: process.env.SSH_AUTH_SOCK
// }
]);

// run commands on localhost
plan.local(function(local) {
  local.log('Copy files to remote hosts');
  var filesToCopy = local.exec('git ls-files', {silent: true});
  // rsync files to all the destination's hosts
  local.transfer(filesToCopy, '/tmp/' + tmpDir);
});

// run commands on remote hosts (destinations)
plan.remote(function(remote) {
  remote.log('Move folder to root');
  remote.sudo('cp -R /tmp/' + tmpDir + ' ~', {user: username});
  remote.rm('-rf /tmp/' + tmpDir);

  remote.log('Install dependencies');
  remote.sudo('npm --production --prefix ~/' + tmpDir + ' install ~/' + tmpDir, {user: username});

  remote.log('Reload application');
  remote.sudo('ln -snf ~/' + tmpDir + ' ~/'+appName, {user: username});
  remote.exec('forever stop ~/'+appName+'/'+startFile, {failsafe: true});
  remote.exec('forever start ~/'+appName+'/'+startFile);
});

这是我尝试部署时所遇到的错误:

代码语言:javascript
复制
Error connecting to 104.131.153.117: Error: Authentication failure. Available authentication methods: publickey,password

我不知道怎么回事。我正试着把它部署到数字海洋。我不知道是什么导致了这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-04 21:54:32

看起来您还没有对远程主机进行正确的身份验证。您需要将SSH密钥添加到远程主机,以便进行无密码访问。

执行此操作的命令是

代码语言:javascript
复制
$ ssh-copy-id <user>@<host>

如果需要指定要使用的确切密钥,请使用以下命令

代码语言:javascript
复制
$ ssh-copy-id -i <path-to-.pub-file> <user>@<host>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30039280

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档