I have an app deployed to dokku running on an ec2 ubuntu instance. I have the .pem
key of the instance and I'm able to connect to it and, apparently, successfully add the remote to git. However, whenever I try to push to the remote it gives me the following error:
ssh: connect to host address.of.the.host port 22: Network is unreachable
fatal: Could not read from remote repository.
Here are the steps that I followed so far:
.pem
file to the folder of the project and set the necessary permissionsssh-add key-file-name.pem
, which returned Identity added: key-file-name.pem (key-file-name.pem)
type C:\Users\Myself\.ssh\id_rsa.pub | ssh -i "C:\Users\Myself\Documents\project_name\key-file-name.pem" ubuntu@ec2-<ip-address>.sa-east-1.compute.amazonaws.com sudo dokku ssh-keys:add my-key
, which returned SHA256:<key>
git remote add prod dokku@address.of.the.host:app-name
git remote --verbose
and confirmed that the remote was added (fetch and push)git push prod master
, which returned the "Network is unreachable" errorI know very little about this stuff. I'm only trying to update the app with some changes that I've made to the code, so I really appreciate anyone that could help.
Ok so I figured out what the problem was (as always, right after exposing it, but ok).
I was adding the romote using the host name (dokku@address.of.the.host:app-name
). Once I changed it to the ip (public IPv4) it worked...
This ip can be found at your aws panel > Services > EC2 > Instances > click on the instance's ID > IPv4 public address.