Connection refused for git push

I am trying to use SSH to push a repo to our Bitbucket server for the first time.  I am probably missing a step since this is all new to me.  If you have any thoughts, let me know. 

The error I get is: ssh: connect to host port 7999: Connection refused fatal: Could not read from remote repository.

Steps I have taken.

On Bitbucket server....

1. Verified SSH enabled, keys enabled, port 7999, and base url=ssh://

2. Created project & repo. (empty repo).  Project key is EBAP.

3.  On the settings>access key of the repo, I copied in the rsa public key. (note: I also tried to adding the public key to the project)

On my pc using Git Bash...

4.  Made sure SSH agent running with private key

5. cd to repo

6. $git remote add bitbucket ssh://

7. $git push -u bitbucket --all


Note: I was able to push the repo using HTTPS but I want to create a script to push using SSH without having to supply credentials.


1 answer

1 vote

Repo access keys are read-only - they cannot be used to push. If you associate that key with a user account, then you should be able to push.

Thanks Jim.  Bare with me - I don't quite understand why the push would not use rsa key.  I guess I thought that any SSH access to the git repos on the bitbucket server from my pc would require a public key added to the server repo. 

In terms of my connection refused issue, I spoke to a system administrator and we are thinking that port 7999 is blocked by the load balancer.  So the sys admin will be looking into that.


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

25,185 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you