git - 比特桶 :Git on Cygwin - Cannot push to remote repository

标签 git cygwin bitbucket git-push

已更新 x3(见下文) 所以我成功地使用了我的 Git Bitbucket 仓库几个月,直到 2012 年 11 月 29 日。直到前几天(2013 年 1 月 24 日)我才尝试再次提交 徒劳无功。我在 Cygwin 中重新安装了我的 ssh 服务器,所以我确信我有一个合适的 联系。我能够从另一个工作站访问我的服务器,所以我 当然可以。我也能够毫无问题地克隆我的 repo 协议(protocol) 使用 ssh 隧道的 Bitbucket。然而,当我试图 push 我的改变时 (在添加、提交等之后)我得到以下信息:

$ 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。外壳访问被禁用。

还有,对于 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。我看到其他人在他们的常见问题解答中遇到了同样的问题,但被转介给 Atlassian 支持。

我开始直接与 Atlassian 支持人员交谈,那个人告诉我查看 Stack Overflow 上的帖子 (Git with SSH on Windows)。发布的解决方案不起作用,所以支持代表随后指示我安装 GitBash 以查看除了 Cygwin 之外是否还有其他问题。我安装了 GitBash 并且能够让它工作并且可以使用 ssh 或 https 再次推送和克隆。我告诉销售代表,他说这是他所能提供的最大帮助,因为我的问题出在我自己的软件上。所以我相信我已经将问题缩小到 Cygwin 中的某种机制,它似乎与 SSH 无关,但可能与 git 有关。

更新 (02/18/13): 今天,我确认我也可以从 Cygwin 中提取。所以现在,我只是遇到了推送问题。我正在考虑将别名映射到 Cygwin 中的 mysysgit,如 Errors cloning git project using Cygwin, msysgit Bash shell works ,但这可能比我现在必须尝试的时间要长。仍在寻找让 Git 在 Cygwin 中本地工作的解决方案。

更新 (02/20/13): 我现在在使用 GitBash 推送时遇到完全相同的错误。在支持页面上看到这个垃圾:https://bitbucket.org/site/master/issue/4406/invalid-command-synthax

这似乎是一个反复出现的问题,他们的支持不会直接解决。从表面上看,这从 2012 年 6 月开始就一直在进行,没有公布任何解决方案。如果有人读到这篇文章并能给我一些指导,我将不胜感激。现在,我已经切换到使用 HTTPS 的 GitBash。

最佳答案

请检查 {project_folder}/.git/config 文件。 如果有远程存储库 URL ssh://。删除它并尝试推送操作。

git push -u origin --all

有效的远程仓库地址

url = git@bitbucket.org:{username}/{project-name}.git

关于git - 比特桶 :Git on Cygwin - Cannot push to remote repository,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14823884/

相关文章:

c# - Bitbucket 管道 .net 部署

java - Spring Cloud Config 无法使用 ssh key 克隆私有(private) bitbucket 存储库

git - 为什么推送后删除的分支没有在远程删除?

ssh - 通过 cygwin openssh 执行时访问被拒绝

git - 如何允许在Mac OS中访问git/config?

linux - 初学者 bash 脚本的错误

linux - Cygwin 串行端口权限被拒绝错误

version-control - 需要帮助在 Windows 8 上使用 sourceTree 连接到 bitbucket 存储库

git - SSH key 停止在源代码树中的 MAC OS Sierra 10.12.3 上工作

git - 如何标记或分类 git 提交