質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

992閲覧

rails6 - capistranoでデプロイをしている途中、git ls-remoteの段階で止まってしまいます。

mnishikawa

総合スコア7

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2019/12/17 18:30

実行環境

Ruby 2.6.2
Ruby on Rails 6.0.2
AWS EC2 Amazon Linux
Capistrano 3.11.2
nginx
unicorn 5.5.1

my歴 独学6ヶ月目


capistranoでrailsアプリをAWS EC2インスタンスにデプロイしようとしていますが、
bundle exec cap production deploy の時に、下記のエラーが出てしまいます。(git ls-remoteの次)

capistrano デプロイ時のエラーコード

$ bundle exec cap production deploy 00:00 git:wrapper 01 mkdir -p /tmp ✔ 01 masahiro@[myIP] 0.091s Uploading /tmp/git-ssh-Kotosearch-production-masahiro.sh 100.0% 02 chmod 700 /tmp/git-ssh-Kotosearch-production-masahiro.sh ✔ 02 masahiro@[myIP] 0.114s 00:00 git:check 01 git ls-remote git@github.com:cutsome/Kotosearch.git HEAD 01 fatal: Unable to find remote helper for 'github' #githubが見つかりません? #<Thread:0x00007fea3b163fa0@/Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true): Traceback (most recent call last): 13: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 12: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `run' 11: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec' 10: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/scm/tasks/git.rake:18:in `block (3 levels) in eval_rakefile' 9: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:100:in `with' 8: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/scm/tasks/git.rake:19:in `block (4 levels) in eval_rakefile' 7: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/scm/git.rb:38:in `check_repo_is_reachable' 6: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/scm/git.rb:77:in `git' 5: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:80:in `execute' 4: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute' 3: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `tap' 2: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute' 1: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/backends/netssh.rb:170:in `execute_command' /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/command.rb:97:in `exit_status=': git exit status: 128 (SSHKit::Command::Failed) git stdout: Nothing written git stderr: fatal: Unable to find remote helper for 'github' 1: from /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute' /Users/masahiro/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as masahiro@[myIP]: git exit status: 128 (SSHKit::Runner::ExecuteError) git stdout: Nothing written git stderr: fatal: Unable to find remote helper for 'github' (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as masahiro@18.176.74.100: git exit status: 128 git stdout: Nothing written git stderr: fatal: Unable to find remote helper for 'github' Caused by: SSHKit::Command::Failed: git exit status: 128 git stdout: Nothing written git stderr: fatal: Unable to find remote helper for 'github' Tasks: TOP => deploy:check => git:check (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as masahiro@[myIP]: git exit status: 128 git stdout: Nothing written git stderr: fatal: Unable to find remote helper for 'github' ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: INFO [cd5c33d3] Running /usr/bin/env git ls-remote git@github.com:cutsome/Kotosearch.git HEAD as masahiro@[myIP] ~~略〜〜

EC2がssh接続でgit cloneする時に起きているエラーだと思いましたので、
githubでEC2公開鍵の設定をし直したり、ssh -T githubでインスタンスから
接続し直したり(成功)しましたが、結局エラー内容はずっと変わらず、、、
ssh-add ~/.ssh/Koto_key_rsaもやりました。

ググっても、fatal: Unable to find remote helper for 'github'
githubが見つかりませんエラーの対処法は載ってなかったので、暗礁に乗り上げています。

以下、各関連ファイルの状態です。

Gemfile

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.2' gem 'rails', '~> 6.0.1' gem 'mysql2' gem 'puma', '>= 4.3.1' gem 'sass-rails', '>= 6' gem 'webpacker', '~> 4.0' gem 'turbolinks', '~> 5' gem 'jbuilder', '~> 2.7' gem 'bcrypt', '~> 3.1.7' gem 'rails-i18n' gem 'faker' gem 'kaminari' gem 'mail-iso-2022-jp' gem 'bootsnap', '>= 1.4.2', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'capistrano' gem 'capistrano-bundler' gem 'capistrano-rails' gem 'capistrano-rbenv' end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' gem 'ed25519', '>= 1.2', '< 2.0' gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0' end group :test do gem 'capybara', '>= 2.15' gem 'selenium-webdriver' gem 'webdrivers' gem 'rails-controller-testing' gem 'minitest' gem 'minitest-reporters' end group :production, :staging do gem 'unicorn' end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Capfile

require "capistrano/setup" require "capistrano/deploy" require "capistrano/scm/git" install_plugin Capistrano::SCM::Git require "capistrano/rbenv" require "capistrano/bundler" require "capistrano/rails/assets" require "capistrano/rails/migrations" # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

config/deploy/production.rb

server "[myIP]", user: "masahiro", roles: %w{app db web} # server "db.example.com", user: "deploy", roles: %w{db} set :ssh_options, { keys: %w(~/.ssh/id_rsa), forward_agent: true, auth_methods: %w(publickey) }

config/deploy.rb

# config valid for current version and patch releases of Capistrano lock "~> 3.11.2" set :application, "Kotosearch" set :repo_url, "git@github.com:cutsome/Kotosearch.git" # Default branch is :master set :branch, 'master' # Default deploy_to directory is /var/www/my_app_name set :deploy_to, "/var/www/rails/Kotosearch" # Default value for :linked_files is [] set :linked_files, fetch(:linked_files, []).push('config/settings.yml') set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system') set :keep_releases, 5 set :rbenv_ruby, '2.6.2' set :log_level, :debug namespace :deploy do desc 'Restart application' task :restart do invoke 'unicorn:restart' end desc 'Create database' task :db_create do on roles(:db) do |host| with rails_env: fetch(:rails_env) do within current_path do execute :bundle, :exec, :rake, 'db:create' end end end end desc 'Run seed' task :seed do on roles(:app) do with rails_env: fetch(:rails_env) do within current_path do execute :bundle, :exec, :rake, 'db:seed' end end end end after :publishing, :restart after :restart, :clear_cache do on roles(:web), in: :groups, limit: 3, wait: 10 do end end end

不明点がありましたらなんでもお答えしますので、
どうか、皆様のお知恵をお借りできればとおもいます。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

自己解決

deploy.rb にて接続先urlを、httpsに変えたら成功しました。

投稿2019/12/17 18:36

mnishikawa

総合スコア7

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問