我正在尝试使用Capistrano和Rails 5进行部署
这是我的Capfile
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
# require "capistrano/rbenv"
# require "capistrano/chruby"
# require "capistrano/bundler"
# require "capistrano/rails/assets"
# require "capistrano/rails/migrations"
# require "capistrano/passenger"
require 'capistrano/rbenv'
require 'capistrano/rbenv_install'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/rails/migrations'
require 'capistrano/rails/assets'
require 'capistrano/unicorn_nginx'
require 'capistrano/safe_deploy_to'
require 'capistrano/ssh_doctor'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
这是我的deploy.rb
# config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"
set :application, "privatext-api"
set :repo_url, 'https://bitbucket.org/dotcreek/privatext-api'
#set :repo_url, 'git@bitbucket.org:dotcreek/privatext-api.git'
set :user, 'deploy'
set :password, proc{Capistrano::CLI.ui.ask('Host Password:')}
set :ssh_options, {forward_agent: true, # Any special options for SSH connections in common for all remote hosts
:keys => [File.join(".", "ssl", "ssh_login_key")] }
# deploy directory on the server. Will be ie: '/var/www/myapp_production'
set :deploy_to, '/srv/websites/privatext/'
# change to ruby version you need
set :rbenv_ruby, '2.6.1'
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, "/var/www/my_app_name"
# Default value for :format is :airbrussh.
# set :format, :airbrussh
# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# append :linked_files, "config/database.yml"
# Default value for linked_dirs is []
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config user.name luisalfonsocb83@gmail.com` }
# Default value for keep_releases is 5
# set :keep_releases, 5
# Uncomment the following to require manually verifying the host key before first deploy.
# set :ssh_options, verify_host_key: :secure
但是我何时执行
盖帽生产git:check
我收到此错误消息:
(in /home/ubuntu/privatext-api)
00:00 git:wrapper
01 mkdir -p /tmp
✔ 01 ubuntu@52.14.68.52 0.049s
Uploading /tmp/git-ssh-privatext-api-production-ubuntu.sh 100.0%
02 chmod 700 /tmp/git-ssh-privatext-api-production-ubuntu.sh
✔ 02 ubuntu@52.14.68.52 0.048s
00:00 git:check
01 git ls-remote https://bitbucket.org/dotcreek/privatext-api HEAD
01 remote: Invalid username or password
01 fatal: Authentication failed for 'https://bitbucket.org/dotcreek/privatext-api/'
#<Thread:0x0000559352dbd270@/home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
13: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
12: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in `run'
11: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
10: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/capistrano-3.11.0/lib/capistrano/scm/tasks/git.rake:18:in `block (3 levels) in eval_rakefile'
9: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:97:in `with'
8: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/capistrano-3.11.0/lib/capistrano/scm/tasks/git.rake:19:in `block (4 levels) in eval_rakefile'
7: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/capistrano-3.11.0/lib/capistrano/scm/git.rb:38:in `check_repo_is_reachable'
6: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/capistrano-3.11.0/lib/capistrano/scm/git.rb:77:in `git'
5: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:78:in `execute'
4: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in `create_command_and_execute'
3: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in `tap'
2: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in `block in create_command_and_execute'
1: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/backends/netssh.rb:169:in `execute_command'
/home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/command.rb:99:in `exit_status=': git exit status: 128 (SSHKit::Command::Failed)
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/dotcreek/privatext-api/'
1: from /home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/ubuntu/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ubuntu@52.14.68.52: git exit status: 128 (SSHKit::Runner::ExecuteError)
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/dotcreek/privatext-api/'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ubuntu@52.14.68.52: git exit status: 128
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/dotcreek/privatext-api/'
Caused by:
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/dotcreek/privatext-api/'
Tasks: TOP => git:check
(See full trace by running task with --trace)
我正在寻找类似的答案 Capistrano Deploy remote: Invalid username or password Github ,但是我发现的唯一问题是使用Github的问题,而且我认为由于需要私有回购协议,所以这个问题有些不同。但是由于这个原因,我需要用户名和密码才能访问。
请收到任何建议。