Windows 10 で Google Cloud SDK 認証方式を使用して Google Cloud Source Repositories に Git プッシュすると、権限が拒否されました (公開キー) 質問する

Windows 10 で Google Cloud SDK 認証方式を使用して Google Cloud Source Repositories に Git プッシュすると、権限が拒否されました (公開キー) 質問する

Google Cloud Source Repository をリモート リポジトリとして使用しようとしています。SSH キーを使用しない (いわゆる) Google Cloud SDK 認証方法で認証するためのすべての手順を実行しました。

問題は、Permission denied (publickey) fatal: Could not read from remote repository.を試行すると常にメッセージが表示されることですgit push --all google

コマンドgcloudは私の Windows PATH (;) にありC:\Users\xxxxx\AppData\Local\Google\Cloud SDK\、私は Google Cloud のプロジェクトの所有者であるため、ユーザーには十分な権限があります。

このメッセージは通常、プロジェクトに公開キーを追加することで解決できる単純な SSH キーの問題であることはわかっていますが、この方法は SSH キーがなくても機能するはずなので、何が間違っているのかを知りたいです。

以下は、Google Cloud Source Repositories の手順に従って作成した最初の 2 つのコマンドです。

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd
git remote add google ssh://[email protected]@source.developers.google.com:2022/p/my-website-project/r/my_website

これら2つはうまく機能しました。

おそらく誰かが、それを修正するために何をすべきかを見つけるのを手伝ってくれるでしょう。

ありがとう。

ベストアンサー1

私も同じ問題を抱えていました。
次の 2 つのコマンドもうまく機能しました:

gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.cmd
git remote add google ssh://[email protected]@source.developers.google.com:2022/p/my-website-project/r/my_website

しかし、これは機能しませんでした:

git push --all google

編集しなければならなかった設定ファイルファイルを動作させると問題が解決しました。以下を追加しました:

Host source.developers.google.com
    HostName source.developers.google.com
    User [email protected]
    IdentityFile ~/.ssh/your_private_key_file_registered_for_the_source_repo

詳細はこちら設定ファイルファイルここ

おすすめ記事