我是 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.
该 repo 存在于 bitbucket 上,并且运行本地命令没有问题。只是 git push 命令。我在这个网站上看到了很多问题,并尝试了无济于事的解决方案。
目前我的 git 是通过 RailsInstaller 安装的。上面的命令在正常的 cmd 提示符下运行,而不是 GitBash shell。
编辑:“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 shell 中)
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 不同步。但是现在知道要检查或更改什么。