git over ssh on windows

Nick Li avatarNick Li created an issue

I uninstalled Git, re-installed the latest version. setup ssh followed https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

But there are some errors. Anyone can help?

I have docs repo in my bitbucket

$ git clone git@bitbucket.org:nickleefly/docs.git
Cloning into 'docs'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Below is some information

$ ssh -v git@bitbucket.org
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/asus/.ssh/config
debug1: Applying options for bitbucket.org
debug1: Connecting to bitbucket.org [207.223.240.182] port 22.
debug1: connect to address 207.223.240.182 port 22: Attempt to connect timed out
 without establishing a connection
debug1: Connecting to bitbucket.org [207.223.240.181] port 22.
debug1: Connection established.
debug1: identity file /c/Users/asus/.ssh/id_rsa 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_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc 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 /c/Users/asus/.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: SSH2_MSG_SERVICE_REQUEST sent
Read from socket failed: The connection was aborted

then I added

Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa
 Port 443

into ~\.ssh\config file then

$ ssh -v git@bitbucket.org
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/asus/.ssh/config
debug1: Applying options for bitbucket.org
debug1: Connecting to bitbucket.org [207.223.240.182] port 443.
debug1: Connection established.
debug1: identity file /c/Users/asus/.ssh/id_rsa type 1
ssh_exchange_identification: Connection closed by remote host

~/.ssh/id_rsa.pub had been added into my account/ ssh`

when i run ssh-add -l the output is the following Could not open a connection to your authentication agent.

Comments (20)

  1. Marcus Bertrand

    We don't support using port 443 for SSH. You should remove that entry from your Host file or change it to the default of port 22. If this still doesn't work, I'd investigate any firewalls between you and Bitbucket's servers. This usually happens if an outbound firewall is blocking or filtering traffic.

  2. Brian Nguyen

    Hi Nick,

    Are you able to push to bitbucket via HTTPS? This should be a reasonable workaround while we work this out.

    It looks like the connection to bitbucket.org is being cut off part way through the ssh handshake. I suspect that it is a firewall that is responsible for this.

    Cheers, Brian

  3. Nick Li

    it doesn't work via https either. ssh was working two weeks ago.

    re-installed git, then I re-added ssh key, it still doesn't work. the same process is working on github

    Cheers

  4. Brian Nguyen

    Hi Nick,

    Hmm it is very strange, that you can access the site but not clone via HTTPS. Do you get the same error when you clone via HTTPS? If not, can you copy and paste the output when you try to clone? Also does this happen with all of your repositories or just one or two?

    Finally, can you tell us where you are located? We are currently being blocked by China so this may be related.

    Cheers, Brian

  5. Nick Li

    Blocked in China? Nooo. That's reason I think, I am in Shanghai China. It was working two weeks ago. GFW is monkeying the request, I will try to use vpn to see if it works, thanks

  6. Brian Nguyen

    Hi Nick,

    I'm glad you've managed to work around the issue. We're still not sure exactly how we are blocked as some of our users are still able to push via HTTPS, it seems a little random at the moment.

    We are investigating how to get us unblocked but we've haven't had this happen to us in some time so it will be a slow process.

    Cheers, Brian

  7. Nick Li

    maybe try to put this into ./ssh/config file

    Host bitbucket.org
    User yourusername
    Hostname bitbucket.org
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
    
  8. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.