【问题标题】:Trying to push to BitBucket but I get "master conq: repository access denied." "fatal: The remote end hung up unexpectedly"尝试推送到 BitBucket 但我得到“master conq:repository access denied”。 “致命:远端意外挂断”
【发布时间】:2012-06-05 16:26:26
【问题描述】:

我这样做是为了推送我的 bitbucket 存储库的更改:

$: git push origin 
master conq: repository access denied. 
fatal: The remote end hung up unexpectedly

这个错误是什么意思,我该如何解决?

bitbucket 的调试信息:ssh -T -v git@bitbucket.org

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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<1024<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: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Remote: Forced command: conq deploykey:435246
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Remote: Forced command: conq deploykey:435246
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
authenticated via agent_smith.


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

This deploy key has read access to the following repositories:

myserver/scripts: root@myserver.stuff.com -- root@myserver.stuff.com
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2440, received 3032 bytes, in 0.0 seconds
Bytes per second: sent 58903.0, received 73194.2
debug1: Exit status 0

上面的认证用户agent_smith有点问题。

【问题讨论】:

  • 我得到了这个确切的错误。 ssh 如何根据不完整的信息假定凭据是一个问题。当用户从其下面被修改时,ssh 会与 bitbucket 服务器协商旧的无效凭据。修复:您必须使用 ssh-keygen 生成新的 ssh 密钥,然后替换 ~/.ssh/id_rsa~/.ssh/id_rsa.pub 的内容。然后你必须进入bitbucket,删除旧密钥,并重新上传你刚刚创建的新ssh密钥。

标签: git bitbucket


【解决方案1】:

在 ssh 访问方面(如类似于ssh://git@bitbucket.org/accountname/reponame.git 的 ssh BitBucket repo 地址,请仔细检查:

注意:在 Windows 上,然后是 environment variable HOME isn't defined by default。确保它是。

【讨论】:

  • 我有多个 bitbucket 帐户,我的公司 ssh_key 存储在单独的文件中。通过在 ~/.ssh/config 中明确引用这些键解决了我的问题
【解决方案2】:

检查你是否有 repo 的写权限。


https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git#SetupSSHforGit-Step4Createaconfigfile:

步骤 4. 创建 SSH 配置文件

Using your favorite text editor, edit an existing (or create a new)
~/.ssh/config file.

Add an entry to the configuration file using the following format:

Host bitbucket.org
 IdentityFile ~/.ssh/privatekeyfile

The second line is indented. That indentation (a single space) is important, 
so make sure you include it.  The second line is the
location of your private key file.  If you are following along with
these instructions, your file is here:

 ~/.ssh/id_rsa

When you are done editing, your configuration looks similar to the following:

Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa

Save and close the file.
Restart the GitBash terminal.

【讨论】:

    【解决方案3】:

    这个 git 错误:

    $: git pull
    master conq: repository access denied. 
    fatal: The remote end hung up unexpectedly
    

    补救措施:

    1. 清除 ~/.ssh 目录中的公共和私有 ssh 密钥
    2. 创建新的 ssh 密钥。
    3. 登录到您的存储库的 bitbucket。
    4. 从 bitbucket 中删除旧的 ssh 密钥。
    5. 将新的 ssh 密钥添加到 bitbucket。
    6. 再试一次,然后 ssh 与正确用户的 bitbucket 协商。

    是什么原因造成的?

    客户端计算机上的 ssh 用于与 bitbucket 协商的凭据已发生更改,导致 bitbucket 认为这是未经授权的用户。

    【讨论】:

      【解决方案4】:

      如果您使用的是 Mac OSX 或 Linux,对我有用的是确保 ssh-agent 已加载并使用我的密钥运行。

      $ ps -e | grep [s]sh-agent
      9060 ??     0:00.28 /usr/bin/ssh-agent -l
      

      检查代理是否正在运行。您应该会看到类似上述结果的内容。如果没有看到以上结果,可以输入

      $ eval ssh-agent $SHELL
      

      手动启动 ssh-agent。接下来,您要检查密钥是否正在运行。类型

      $ ssh-add -l
      2048 68:ef:d6:1e:4b:3b:a3:52:6f:b0:c3:4b:da:e8:d1:9f /c/Documents and Settings/manthony/.ssh/personalid (RSA)
      

      您应该会看到上述结果。如果你不这样做,你可以输入

      $ ssh-add ~/.ssh/workid
      

      其中workid 是您生成的私钥集的名称。

      直接取自此链接:Configure multiple SSH identities for GitBash, Mac OSX, & Linux

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-03-11
        • 2012-07-31
        • 2011-10-12
        • 2013-02-04
        • 1970-01-01
        • 2013-02-20
        • 1970-01-01
        相关资源
        最近更新 更多