Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Git to use a .pem key from a specific location

Tags:

git

ssh

Whenever I try to do a 'git pull origin master' I get (It is NOT Github):

Permission denied (publickey).

I am able to SSH into my AWS EC2 Linux sever, which has the bare repository, which I'm trying to pull from when I get the aforementioned permission error.

I have indeed copied the public key to that server, because I can login successfully via ssh, but only by doing a:

ssh -i /location/of/pemkey/mykey.pem [email protected]

I need to configure Git to use my '.pem' key. How do I accomplish setting up Git to utilize my '.pem' key?

like image 556
ConfusedDeer Avatar asked Jun 22 '15 05:06

ConfusedDeer


1 Answers

1. touch ~/.ssh/config
2. chmod 644 ~/.ssh/config
3. vim ~/.ssh/config
    #write next codeline
    host ec2-ip.eu-west-1.compute.amazonaws.com
    IdentityFile ~/Documents/ec2-user.pem

git clone [email protected]:/home/git/my-repo.git
like image 61
dmitri Avatar answered Sep 24 '22 18:09

dmitri