Phew – 4.5 hours later, the problem is solved! Let me save you 4 hours and 25 minutes, if you are submitting / getting the response below when trying to connect to your GIT repository from within a company firewall (on Windows):
$ ssh -T [email protected]
ssh: connect to host bitbucket.org port 22: Bad file number
The problem I had related to proxy authentication. I was able to make this work by updating the config file in the ~/.ssh folder. This is normally located in C:users[username].ssh. If the file does not exist, create it – and add the information below:
ProxyCommand connect.exe -H [ProxyUser]@[ProxyServer]:[ProxyPort] %h %p
Note the space before IdentityFile (apparently this is important). The %h and %p values are replaced with target hostname and port when ProxyCommand is invoked by your ssh command. But you do need to provide your system values for the [ProxyXXX] settings. So how do you get the proxy server details (when the browser is set to auto-detect proxy settings)? Well, the [ProxyUser] is most likely your login name (it was for me). The rest can be worked out from this thread.
Here is the command I used to pull my repository (note the lack of a slash before OWNER):
git clone [email protected]:OWNER/REPOSITORY.git