title: bibucket ssh_exchange_identification: read: Connection reset by peer
body: <p>I'm trying to setup a passwordless git connection to bitbucket. I'm using git bash on Windows Server 2008.</p>
  
  <p>Cloning over HTTPS works fine:</p>
  
  <pre><code>nskoric@P8-DEV /z/test
  $ git clone https://dijxtra@bitbucket.org/nek-plan/gittest.git
  Cloning into 'gittest'...
  Password for 'https://dijxtra@bitbucket.org':
  remote: Counting objects: 3, done.
  remote: Total 3 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (3/3), done.
  Checking connectivity... done.
  </code></pre>
  
  <p>But, HTTPS is not acceptable because I need passwordless login. So I generated a private/public key pair, uploaded public key to bitbucket and set up Host/IdentitiyFile in .ssh/config. Then I tried connecting and failed.</p>
  
  <p>Port 22 is closed on my company firewall:</p>
  
  <pre><code>nskoric@P8-DEV /z/test
  $ ssh git@bitbucket.org -vv
  OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
  debug1: Reading configuration data /u/.ssh/config
  debug1: /u/.ssh/config line 1: Applying options for *bitbucket.org
  debug2: ssh_connect: needpriv 0
  debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
  </code></pre>
  
  <p>So, I'm using port 443, as per bitbucket documentation:</p>
  
  <pre><code>nskoric@P8-DEV /z/test
  $ git clone ssh://git@altssh.bitbucket.org:443/nek-plan/gittest.git
  Cloning into 'gittest'...
  ssh_exchange_identification: read: Connection reset by peer
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  </code></pre>
  
  <p>I tried googling "bitbucket ssh_exchange_identification: read: Connection reset by peer", but it didn't help :-/ Then I tried debugging SSH connection, but this is farthest I got:</p>
  
  <pre><code>nskoric@P8-DEV /z/test
  $ ssh git@altssh.bitbucket.org -p 443 -vv
  OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
  debug1: Reading configuration data /u/.ssh/config
  debug1: /u/.ssh/config line 1: Applying options for *bitbucket.org
  debug2: ssh_connect: needpriv 0
  debug1: Connecting to altssh.bitbucket.org [131.103.20.174] port 443.
  debug1: Connection established.
  debug1: identity file /u/.ssh/bitbucketnek type 1
  debug1: identity file /u/.ssh/bitbucketnek-cert type -1
  debug1: Enabling compatibility mode for protocol 2.0
  debug1: Local version string SSH-2.0-OpenSSH_6.6.1
  ssh_exchange_identification: read: Connection reset by peer
  </code></pre>
  
  <p>So, SSH found the right identity file (/u/.ssh/bitbucketnek) and then died. Now, it would be really helpful if I could figure out if the problem is in my "bitbucketnek" private key, or is the problem in our company firewall, or something third. Any ideas?</p>
  
  <p>Thanks!</p>