Saturday, July 30, 2022

[SOLVED] Add AWS Lightsail SSH to Bitbucket SSH to allow access to cloning Repos

Issue

I want to be able to work with git via my AWS Lightsails SSH terminal running on bitnami, how do I connect the terminal to bitbucket via SSH so that I can clone the repo each time I need to make a deployment. Also If there are better ways of deploying a nuxt app to aws lightsails, please share.


Solution

Before you choose to go this route consider that cloning a repo isn't going to make lightsail work automatically. You still have to prepare the correct entry point (domain) and then for example if you're running an express server you'd have to prepare the lightsail instance for that.

Having said that create an ssh key:

1. ssh-keygen -t ed25519 -C "your email"
2. Save to directory (you can change if you'd like): 
    Enter file in which to save the key (/home/bitnami/.ssh/id_ed25519)
3. Enter password or hit return for no password
4. Copy your ssh key: cat /home/bitnami/.ssh/id_ed25519.pub
5. In bitnami click your repository then you will see left hand menu.  There click on Repository Settings
6. Click Access keys (left hand menu)
7. Click Add Key
8. Enter the label and paste the contents of step 4 (should be in terminal of step 4).  Click Add SSH Key.

After this you should be able to clone and execute git commands. (Please make sure git is added to the server)



Answered By - FabricioG
Answer Checked By - Mary Flores (WPSolving Volunteer)