-1

I am new to AWS and followed a tutorial to set up git in aws and the push my local files into it. I have a Key with me with .pem extension which got generated while I was creating the instance. I have added the remote repository like this: git remote add production ssh://root@35.154.37.131/var/repo/site.git

after this when I tried to push into the repository I got:

$ git push production master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

torek
  • 448,244
  • 59
  • 642
  • 775
  • You need to set up an ssh keypair. The `.pem` file has nothing to do with ssh keypairs. Note also that `git push` does not push *files*, but rather *commits*. The receiving Git gets whole commits, not individual files. – torek Aug 30 '21 at 10:44

1 Answers1

0

You will need to specify your key which is in the .pem to be used when connecting to your server.

Setup an SSH config file in your SSH directory (on Linux / Mac OS this is under $HOME/.ssh/config) and enter an entry similar to this

Host 35.154.37.131 
User root
IdentityFile ~/.ssh/my-private-key.pem
Michael Anckaert
  • 853
  • 8
  • 12