0

私はgitが初めてです。新しいプロジェクトを bitbucket リポジトリにプッシュしようとしていますが、機能していないようです。ssh キーを正しく追加して実行しました。

git remote add origin git@bitbucket.org:<username>/hello-app.git

ユーザー名は私の bitbucket ユーザー名に置き換えられました...

これをもう一度実行したときと同じように機能したようです。「致命的: リモートオリジンは既に存在します」と表示されます。

プッシュの実行によるコンソール出力は次のとおりです。

C:\rails-dev\hello-app>git push -u origin --all
no such identity: /c/Users/Christopher/ssh/id_rsa: No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

リポジトリは bitbucket に存在し、ローカル コマンドの実行に問題はありませんでした。git push コマンドだけです。このサイトで多くの質問を見て、解決策を試してみましたが役に立ちませんでした。

現在、私の git は RailsInstaller 経由でインストールされています。上記のコマンドは、GitBash シェルではなく、通常の cmd プロンプトで実行されます。

編集:「git remote -v」の出力

C:\rails-dev\hello-app>git remote -v
origin  git@bitbucket.org:c_parry/hello-app.git (fetch)
origin  git@bitbucket.org:c_parry/hello-app.git (push)

編集 2: ssh -v -T git@bitbucket.org (GitBash シェルで) を実行したときの出力

logged in as c_parry.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

プロジェクトディレクトリで同じコマンドを実行して出力します。

C:\rails-dev\hello-app>ssh -v -T git@bitbucket.org
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/Christopher/.ssh/config
debug1: /c/Users/Christopher/.ssh/config line 1: Applying options for     bitbucket.org
debug1: Connecting to bitbucket.org [104.192.143.2] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Christopher/ssh/id_rsa type -1
debug1: identity file /c/Users/Christopher/ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /c/Users/Christopher/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/Christopher/ssh/id_rsa
no such identity: /c/Users/Christopher/ssh/id_rsa: No such file or directory
debug1: No more authentication methods to try.
Permission denied (publickey).

gitbash と cmd が同期していないと思います。ただし、何を確認または変更する必要があるかはわかりました。

4

2 に答える 2

1

データを bitbucket リポジトリにプッシュするには、bitbucket のユーザー アカウントとリポジトリの書き込み権限が必要です。確認してください。

于 2016-02-09T12:54:29.417 に答える
1

更新された回答:

更新された質問の詳細なログを見ると、ssh 構成ファイル (/c/Users/Christopher/.ssh/) を正常にロードしているディレクトリと、キーを探しているディレクトリ (/ c/Users/Christopher/ssh/)。

ssh 構成ファイルが「.」なしでディレクトリを参照しているようです。キーを指定するときの最初に。

(同様のエラーメッセージを探している他の人に役立つ場合に備えて、元の回答を以下に残しました)

元の回答:

「no such identity: /c/Users/Christopher/ssh/id_rsa: No such file or directory」というエラー メッセージは、ssh で公開鍵認証を使用しようとしているが、探している ID ファイルが使用されていないことを示しています。存在しません。

基本的に、ssh ID を作成し、関連する設定ページで公開キーを Bitbucket にアップロードする必要があります。

このページには段階的なチュートリアルがあります: https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

そのすべてを実行したくない場合は、「git remote add」行に関連する https URL を指定することで、おそらく https 経由で接続できます。URL はおそらく次のようなものです: https://<username>@bitbucket.org/<username/>hello-app.git

于 2016-02-09T13:00:25.010 に答える