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?
Best How To :
git(1) man page:
If this environment variable is set then git fetch and git push
will use this command instead of ssh when they need to connect to a
remote system. The $GIT_SSH command will be given exactly two or
four arguments: the [email protected] (or just host) from the URL and
the shell command to execute on that remote system, optionally
preceded by -p (literally) and the port from the URL when it
specifies something other than the default SSH port.
To pass options to the program that you want to list in GIT_SSH you
will need to wrap the program and options into a shell script, then
set GIT_SSH to refer to the shell script.
Usually it is easier to configure any desired options through your
personal .ssh/config file. Please consult your ssh documentation
for further details.
In my personal experience, the one-time cost of adding host settings in
.ssh/config has made a big difference, even for hosts where only the username is different.