2016-05-12 8 views
1

は、次のエラーで失敗します。Azureのnpmはどの.ssh/known_hostsファイルを使用していますか? Azureのアプリケーションサービスインスタンスにクーズーのコンソールから<code>npm install git+ssh://<git repo url></code>を実行

npm ERR! Host key verification failed. 
npm ERR! fatal: Could not read from remote repository. 

人々は.ssh/known_hostsファイルにホストの鍵を追加することによって、このエラーを解決often。問題は、正しいキーがすでに存在していることです。それがなければ、git clone <git repo url>は同じエラーで失敗しますが、失敗します。リポジトリは正常にリポジトリをクローンします。

問題をデバッグするために(git cloneと、それはデバッグ情報を出力しながら)、私は~/.ssh/configファイルを経由してDEBUG3にSSHのログレベルを設定しようとしましたが、出力は変化しませんでした。

そのため、Azureのnpmで使用されているSSHクライアントが~/.sshディレクトリを考慮していないという問題があると思われます。

私の質問は、これはどこか文書化されていますか、それともバグですか?どのコンポーネントがバグであるかを知っていますか?

FTR、全出力は次のとおりです。

npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: Cloning into bare repository 'D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85'... 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: Host key verification failed. 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: fatal: Could not read from remote repository. 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: Please make sure you have the correct access rights 
npm ERR! git clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85: and the repository exists. 
npm ERR! Windows_NT 6.2.9200 
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\4.2.3\\node.exe" "D:\\Program Files (x86)\\npm\\3.5.1\\node_modules\\npm\\bin\\npm-cli.js" "install" "git+ssh://<git repo url>" 
npm ERR! node v4.2.3 
npm ERR! npm v3.5.1 
npm ERR! code 128 



npm ERR! Command failed: git -c core.longpaths=true clone --template=D:\local\AppData\npm-cache\_git-remotes\_templates --mirror <git repo url> D:\local\AppData\npm-cache\_git-remotes\git-ssh-<git repo url>-dc8c35134031285cb7109c3e32618e85 
npm ERR! Host key verification failed. 
npm ERR! fatal: Could not read from remote repository. 
npm ERR! 
npm ERR! Please make sure you have the correct access rights 
npm ERR! and the repository exists. 
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <https://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  D:\home\site\foo\npm-debug.log 
+0

あなたはこれを理解しましたか?私はここで同じ問題に取り掛かっているようだ。 – puzzle

+0

「この問題はGitHubで見つかりました」(https://github.com/projectkudu/kudu/issues/1044)、npmで使用される '%USERPROFILE% 'に別の' .ssh'設定フォルダがあることを示します。私の壊れたインスタンスでは、このフォルダは空でした。作業中のインスタンスには、 'D:\ home \ .ssh'にあるものと同じ設定が含まれていました。不足しているSSH設定ファイルを自宅からコピーして固定しました。 – puzzle

答えて

0

は、ここでSSHの設定(設定ファイル、既知のホスト、公開鍵/秘密鍵)はAzureのアプリケーションサービス上で処理されるように見える方法は次のとおりです。

  1. SSH設定のデフォルトフォルダはD:\home\.sshです。これは、KuduデバッグコンソールのSSHとGitが使用するものです。あなたはtrigger host key generationhttps://your-site.scm.azurewebsites.net/sshkey?ensurePublicKey=1を通じて、それはD:\home\.sshフォルダを作成し、それにStrictHostKeyChecking noと設定ファイル(だけでなく、新たに生成したSSHキー)を配置します

  2. 。これは、デバッグコンソールを実行するSSHがホストキーを自動的に受け入れることを意味します。

  3. npm Azure App Serviceでは、%USERPROFILE%にSSHの設定が必要です。初めてDebug Consoleでnpmを実行すると、空のフォルダ%USERPROFILE%\.sshが作成されることがわかります。 NPMの互換性のため

  4. 、クーズーの展開スクリプトは%USERPROFILE%D:\home\.sshフォルダをコピーします(issue/fix参照)。これは、WebアプリケーションのローカルGitリポジトリ、Github、またはKuduをトリガーする他のデプロイメントオプションを介してデプロイするたびに実行されるはずです。スケーリング時にアプリを再起動したときに%USERPROFILE%.sshフォルダをコピーした私の経験では、

  5. が再び削除されます。

私のケースでは、別のnpm/git/sshの問題をデバッグするときに、Webアプリケーションを再起動したと思います。デバッグコンソールで手動でnpm installを実行すると、ホストキーの確認の問題が発生しました。

関連する問題