Which port to open when cloning a git repository from Bitbucket?

Sharing is caring!

To clone a git repository from BitBucket you can do that either via HTTPS (port 443) or via ssh which is port 22.

So your administrator may have to allow outgoing connections to port 22. https/443 are probably allowed already.

To open port 22 on Ubuntu run this command

ufw allow out 22

repo url should look like this git@bitbucket.org:your-workspace/project.git

If you really need to open 443 run this command.

ufw allow out 443

repo url should look like this https://your-username@bitbucket.org/your-workspace/project.git

If you need to deploy via ssh you need to set the private key like this. You need to add your public key in the repo
https://bitbucket.org/your-workspace/project/admin/access-keys/

export GIT_SSH_COMMAND="ssh -T -v -i $HOME/.ssh/bitbucket_deployment_private_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

If you need to generate private and public keys use qSandbox Bitbucket Deployment Key Generator

UFW commands are related to Ubuntu firewall commands and must be run as root.

Subscribe to our newsletter

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *

Free Online Store by Go359.com
The new new server is up and running. Enjoy!