8

ここ数週間、github と capistrano を使用して、Rails 4 アプリケーションを Rackspace にデプロイしています。最終的にリポジトリを非公開にするまで、すべてがうまくいきました。現在、「cap deploy」を実行した後、次のエラーが表示されます。

「致命的: ' https://username@github.com ' のパスワードを読み取れませんでした: そのようなデバイスまたはアドレスはありません」

以下は私の deploy.rb ファイルのコードです

set :application, "appname"
set :repository,  "https://git_username@github.com/git_username/appname.git"
set :scm, :git
set :scm_username, "git_username"
set :scm_passphrase, "git_password"
set :scm_command, "git"
set :keep_releases, 5
set :branch, "master"
set :rails_env, "production"

set :deploy_to, "/var/www/doLocal"

set :user, "deployer"
set :password, "deployer_password"
set :use_sudo, false

ssh_options[:forward_agent] = true

server "/path/to/server", :app, :web, :db, :primary => true

after "deploy:restart", "deploy:cleanup"


namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

githubリポジトリ名の前にユーザー名を追加して、または追加せずに試しました。存在する場合は上記のパスワード エラーを受け取りますが、存在しない場合は次のエラーを受け取ります。

「致命的: ' https://github.com ' のユーザー名を読み取れませんでした: そのようなデバイスまたはアドレスはありません」

問題は何ですか?プライベートリポジトリに変更したことと関係があると思います。私はsshの使用についていくつか読んだことがありますが、そうでないことも読んでいます。

どんな提案や助けも大歓迎です!

4

3 に答える 3

19

それで、私はそれを理解しました。Github のプライベート リポジトリを使用して https を使用してデプロイするには、Github の OAuth API を使用する必要があります。github アカウントの [プロファイルの編集] で、[アプリケーション] をクリックし、OAuth トークンを生成します。次に、トークンを次のようにレポ URL の先頭に追加します。

 set :repository,  "https://<OAuthToken>@github.com/username/application.git"

その後、走ることができました

 cap deploy

アプリケーションをリモート サーバーにデプロイします。

于 2013-09-25T18:27:19.533 に答える
16

質問自体は Ruby 固有のものですが、エラー メッセージは一般的な git エラーです。

したがって、ここにたどり着いた他の人のために、ここにレール以外の答えがあります。不足しているデバイスは実際にはコンソールです。

  1. 非対話的に (つまり、SSH キーを使用して) 認証しようとしました。これは失敗しました。
  2. フォールバックとして、git はユーザーにユーザー名の入力を求めようとしましたが、インタラクティブなコンソールが利用できないため、これは機能しません。

デプロイ中に対話的に認証したくない可能性があるため、#1 を修正します。私の場合、それは github oauth の問題でした。

于 2014-02-10T11:45:41.303 に答える
0

fatal: could not read Username for 'https://github.com': No such device or address"

github username最初のチェックもあなたのコードでscm userサーバーと同じですか?user

あなたのコード

 set :scm_user, "user"
 set :user, "user"

そのはず

 set :user, "deployer"  # The server's user for deploys
 set :scm_user, "ram"  # The   github username

パスフレーズも設定

  set :scm_passphrase, "p@ssw0rd"  # The deploy user's password

今、リポジトリのケース..私が思うに、リポジトリの設定は

set :repository, "git@github.com:username/repo.git"  # Your clone URL

また

 set :ssh_options, { :forward_agent => true }
于 2013-09-19T05:43:08.063 に答える