Bitbucket: 在Cygwin上使用Git - 无法推送到远程仓库

4
更新x3(请参见下文) 直到2012年11月29日,我一直成功使用我的Git Bitbucket存储库。直到最近我想再做一次提交(01/24/13),但却无法完成。我在Cygwin中重新安装了ssh服务器,确保我有一个正确的连接。我能够从另一台工作站访问我的服务器,所以我确定那里没问题。我也能够使用ssh隧道从Bitbucket克隆我的存储库而没有任何问题。然而,当我试图推送我的更改(添加、提交等)时,我遇到了以下错误:
$ git push origin master    
Enter passphrase for key '/home/[User]/.ssh/id_rsa':    
conq: invalid command syntax.    
fatal: The remote end hung up unexpectedly

我在论坛、常见问题等地方搜索了很久,但没有找到答案。以下是我的ssh输出:

$ ssh -T git@bitbucket.org
Enter passphrase for key '/home/[User]/.ssh/id_rsa':
conq: logged in as [username].

您可以使用git或hg连接到Bitbucket。Shell访问被禁用。
此外,对于ssh -v:
$ ssh -v
OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]

还有git --version:

$ git --version
git version 1.7.5.1

正如我所说,ssh似乎正常工作,这看起来是其他问题。

--更新-- 以下是ssh -v -T git@bitbucket.org的输出结果:

$ ssh -v -T git@bitbucket.org
OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to bitbucket.org [207.223.240.181] port 22.
debug1: Connection established.
debug1: identity file /home/[User]/.ssh/id_rsa type 1
debug1: identity file /home/[User]/.ssh/id_rsa-cert type -1
debug1: identity file /home/[User]/.ssh/id_dsa type -1
debug1: identity file /home/[User]/.ssh/id_dsa-cert type -1
debug1: identity file /home/[User]/.ssh/id_ecdsa type -1
debug1: identity file /home/[User]/.ssh/id_ecdsa-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.8
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: 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 /home/[User]/.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: Offering RSA public key: /home/[User]/.ssh/id_rsa
debug1: Remote: Forced command: conq username:[username]
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 279
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/[User]/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Remote: Forced command: conq username:[username]
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([207.223.240.181]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
conq: logged in as [username].

You can use git or hg to connect to Bitbucket. Shell access is disabled.
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 2576, received 2984 bytes, in 0.3 seconds
Bytes per second: sent 7759.0, received 8988.0
debug1: Exit status 0
更新(02/17/13): 我在Bitbucket网站的支持页面上搜索,但他们只详细介绍了如何在Windows上使用GitBash设置Bitbucket,而没有介绍如何在Cygwin上设置。我看到其他人在FAQ上遇到了同样的问题,但是被引荐到了Atlassian支持。我直接与Atlassian支持联系,那个人告诉我要检查Stack Overflow上的一篇文章(Windows上的SSH Git)。发布的解决方案没有起作用,因此支持代表随后指示我安装GitBash以查看是否存在除Cygwin之外的其他问题。我安装了GitBash,并能够使用ssh或https再次推送和克隆。我告诉代表,他说由于我的问题与我的软件有关,所以这就是他能提供的帮助。因此,我相信我已经将问题缩小到Cygwin内部的某些机制,似乎与SSH无关,但可能与git有关。

更新(02/18/13): 今天,我确认我也可以从Cygwin中拉取。所以现在,我只有推送的问题。我正在考虑在Cygwin中映射一个别名到msysgit,如使用Cygwin克隆git项目时出错,msysgit Bash shell工作,但这可能需要更多的时间来尝试。仍在寻找解决方案,以在Cygwin中本地运行Git。

更新(02/20/13): 现在我使用GitBash推送时出现了完全相同的错误。看看支持页面上的这个垃圾:https://bitbucket.org/site/master/issue/4406/invalid-command-synthax。这似乎是一个反复出现的问题,他们的支持不会直接解决。从外观上看,这个问题自2012年6月以来一直存在,没有公布的解决方案。如果有人阅读此文并能给我一些指导,我将非常感激。目前,我已切换到使用HTTPS的GitBash。

你把那台电脑的密钥上传到 Bitbucket 了吗? - jimiyash
是的,密钥已上传。在新年之前一切都很正常。所有密钥都已设置并正常工作。 - Sekkou527
所以我在Mac OS 10.8.3上使用Git git version 1.7.9.6 (Apple Git-31.1),并且遇到了相同的问题。 - Saurabh Kumar
4个回答

3
请检查 {project_folder}/.git/config 文件。如果有远程仓库URL是 ssh://,请删除它并尝试 push 操作。
git push -u origin --all

有效的远程仓库URL
url = git@bitbucket.org:{username}/{project-name}.git

1

我已经开始与Atlassian支持团队合作,但他们的帮助人员让我安装和设置了GitBash,但并没有解决这个问题。因此,我在这里提出请求,希望能得到帮助。 - Sekkou527
另外,您所引用的支持页面并未涉及使用Cygwin,仅限于GitBash。 - Sekkou527

0

0

这个问题已经解决了。原因是一些客户有独特的receivepack配置设置。虽然我不知道哪个客户决定设置这个,但是许多用户受到影响,因为Bitbucket的系统没有设计处理SSH上的非连字符git命令语法。现在,Bitbucket已经更改了这个设置,允许git-receive-pack和git receive-pack同时工作。

作为参考,请检查您的全局配置,您可能会看到类似以下内容:

remote.origin.receivepack git receive-pack

当默认情况下未设置时,但具有默认值git-receive-pack


请注意,如果这不能解决问题,请到Bitbucket支持中心告诉我们。 - Marcus

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接