Question

I keep a Git server on Amazon EC2, and in order to push or pull to it I need to run ssh-add ~/.ssh/pem/Me.pem. Is there any way to add this .pem file to the Git config such that I won't have to run ssh-add each time? I'm thinking of a configuration file in a similar vein to ~/.ssh/config which lets users configure just such an option (IdentityFile ~/.ssh/pem/Me.pem).

Était-ce utile?

La solution

In a fit of inspiration just after posting, I added the following to ~/.ssh/config:

Host someServer
    Hostname 1.2.3.4
    User ubuntu
    IdentityFile ~/.ssh/pem/Me.pem

And I simply cloned the Git repo as such:

git clone ssh://someServer/opt/git/someRepo.git

This has the terrific effect of including the .pem file as needed.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top