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

If you need to test drive WordPress, Try it now!

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

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.

Sharing is caring!

If you need to test drive WordPress, Try it now!
This code shared in this post/site is provided "AS IS" without any warranties or guarantees of any kind. The authors and distributors of this code cannot be held responsible for any damage, data loss, or other issues that may arise from its use. It is strongly recommended that you test this code in a staging environment before deploying it to a live site. Always ensure you have proper backups and understand the implications of running this code on your WordPress installation. Use at your own risk.

Leave a Comment

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