简体   繁体   中英

Bitbucket :Git on Cygwin - Cannot push to remote repository

Updatedx3 (See below) So I was successfully using my Git Bitbucket repo for months up until 11/29/12. I did not try and make another commit until the other day (01/24/13) to no avail. I reinstalled my ssh server in Cygwin so I assured I had a proper connection. I am able to access my server from another workstation, so I am certain that is okay. I was also able to clone my repo with no issue from Bitbucket using an ssh tunnel. However, when I tried to push my changes (after adding, committing, etc.) I get the following:

$ git push origin master    
Enter passphrase for key '/home/[User]/.ssh/id_rsa':    
conq: invalid command syntax.    
fatal: The remote end hung up unexpectedly

I have searched the forums, FAQs, etc. to no avail. Here is the output for my ssh:

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

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

And also, for 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]

And git --version:

$ git --version
git version 1.7.5.1

As I said, ssh seems to be working, this looks to be something else.

--Update-- Here is the output for 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

Update (02/17/13): I searched through the support page on Bitbucket's site, but they only detail how to set up Bitbucket with GitBash on Windows and not Cygwin. I saw where others had had the same problem on their FAQ, but were referred to Atlassian support.

I started speaking directly with Atlassian support and the guy told me to check a post on Stack Overflow ( Git with SSH on Windows ). The solution posted did not work, so the support rep then instructed me to install GitBash to see if there was some other problem besides Cygwin. I installed GitBash and was able to get it working and could push and clone again using ssh or https. I told the rep and he said that was as far as he could help since my issue was with my own software. So I believe I have narrowed the problem to some mechanism within Cygwin that does not seem to be SSH related, but perhaps something to do with git.

Update (02/18/13): Today, I confirmed that I was also able to pull from Cygwin. So now, I just have the issue with push. I am considering just mapping an alias to mysysgit inside of Cygwin as in Errors cloning git project using Cygwin, msysgit Bash shell works , but that may take more time than I have to try right now. Still looking for a solution to get Git working natively in Cygwin.

Update (02/20/13): I now have the exact same error pushing with GitBash. See this garbage at the support page: https://bitbucket.org/site/master/issue/4406/invalid-command-synthax

It seems to be a recurring problem that their support will not directly address. From the looks of it, this has been going on since June of 2012 with no published resolution. If anyone reads this and can give me some direction, I would greatly appreciate it. For now, I have switched to GitBash using HTTPS.

Please check {project_folder}/.git/config file. If have remote repository URL ssh:// . Remove it and try push operation.

git push -u origin --all

valid remote repository url

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

https://bitbucket.org/site/master/issue/4218/conq-invalid-repository-syntax

"For SSH issues, please try our troubleshooting guide at https://confluence.atlassian.com/display/BITBUCKET/Troubleshooting+SSH+Issues first. If you continue to have issues, then raise them to support@bitbucket.org or http://answers.atlassian.com where either support or the community can help address any issues with your configuration."

This issue is fixed. It was due to some clients having a uniquely set receivepack configuration. While I don't know what client decided to set this, numerous users were affected because Bitbucket's system wasn't designed to handle the non hyphenated git command syntax over SSH. Bitbucket has now changed this to allow for both git-receive-pack and git receive-pack to work.

For reference, check your global config and you'll probably see something like:

remote.origin.receivepack git receive-pack

When, by default, it isn't set, but has a default of git-receive-pack

I followed the instructions in this blogpost:

http://blog.cyplo.net/2012/10/25/using-git-in-cygwin-with-bitbucketgithubother-key-reliant-service/

It worked after I changed the group of the .ssh folder from None to Users

chown abudaan:Users .ssh -R

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM