Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SSH Connection refused - the answer must be simpler than everything I tried.

yoyilmaz March 25, 2019

Hey all.

I've added my dev machine's SSH key to my BitBucket account... I can access my repos all good.

I've added the SSH key of my staging server to my bitbucket account, the same was as above. However I am getting errors. Here's some output for debug:

 

staging@staging1:~/web/client.ppstaging.com$ service ssh status
ssh start/running, process 1187

staging@staging1:~/web/client.ppstaging.com$ ssh-add -l
Could not open a connection to your authentication agent.

staging@staging1:~/web/client.ppstaging.com$ eval `ssh-agent`
Agent pid 13156

staging@staging1:~/web/client.ppstaging.com$ ssh-add -l
The agent has no identities.

staging@staging1:~/web/client.ppstaging.com$ ssh-add ~/.ssh/id_rsa
Identity added: /home/staging/.ssh/id_rsa (/home/staging/.ssh/id_rsa)

staging@staging1:~/web/client.ppstaging.com$ ssh-add -l
2048 6b:f6:f3:f7:90:53:4b:20:de:9f:72:a8:ad:e2:c5:a8 /home/staging/.ssh/id_rsa (RSA)

staging@staging1:~/web/client.ppstaging.com$ ssh -v git@bitbucket.org
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [2406:da00:ff00::6b17:d1f5] port 2257.
debug1: connect to address 2406:da00:ff00::22c5:2ef4 port 2257: Connection refused
debug1: Connecting to bitbucket.org [18.205.93.1] port 2257.
debug1: connect to address 18.205.93.1 port 2257: Connection timed out
ssh: connect to host bitbucket.org port 2257: Connection timed out

 

Is it a problem with port 2257?

Is there something I missed during setup?

I've been going around in circles with this. Any direction appreciated.

Thank you.

 

3 answers

0 votes
Ellite Hanry June 12, 2025

Hii, @yoyilmaz 

The SSH is a method of securely getting access to the remote device or server over an insecure network usually over the internet. This encryption ensures that nobody else other than the sender and the intended recipient can intercept and alter information that is being transferred during the remote session. The error "SSH Connection Refused" is generally faced due to the following causes which are as follows:- 

1) SSH service not working

2) Firewall SSH port now working

3) Incorrect SSH configuration

4) Network issue

5) Service overload

6) SSH Key Authentication issue

7) Server Maintenance or updates 

Any of this could be the reasons for the error to be occured. There are different ways to fix the error, that you need to understand in detail which would be helpful in solving it, as I have come across one helpful resource in detail for the error solution at:-https://cheapsslweb.com/resources/how-to-fix-the-ssh-connection-refused-error.  


I hope it helps

0 votes
yoyilmaz March 26, 2019

I found the issue to be in my ssh_config file.

It was set to use port 2257 for some reason, instead of the default.

Removing that line fixed everything.

0 votes
Francesc_Arbó
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 25, 2019

Hi @yoyilmaz ,

I attach the Atlassian documentation related to your problem: https://confluence.atlassian.com/bitbucket/troubleshoot-ssh-issues-271943403.html

Hope it works.

yoyilmaz March 25, 2019

Thanks @Francesc_Arbó

I've been up and down that page a dozen times to get this far anyway.

yoyilmaz March 25, 2019

I added my server's pub SSH key to my BitBucket account, under my personal details. I have a team (where I am the Admin), and a project with 3 repos. I figured that I simply need to add this SSH key to "me", and not the team / project / individual repos -- since BitBucket knows which repos I have access to.

Could there be a problem there somewhere?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events