threads / discuss / 17547

GIT over ssh with identity file

Subject: GIT over ssh with identity file

## tl;dr

4 messages between Feb 4, 2009 and Feb 4, 2009.

replies: 3people: 3as markdown or json

oliverw· Feb 4, 2009, 08:37 UTC · lore

Forgive me if this has been answered before. I've searched everywhere but couldn't find a solution.

Is it somehow possible to pass your private key file to git when working over ssh. What I have in mind would be something like this:

git -i /path/to/private/key clone ssh://homer@foo.bar.com/var/git/repos.git 

Since I want to use this on a server I would like to avoid using a password caching agent at all cost.

-- 
View this message in context: http://www.nabble.com/GIT-over-ssh-with-identity-file-tp21826348p21826348.html
Sent from the git mailing list archive at Nabble.com.
Junio C Hamano· Feb 4, 2009, 08:41 UTC · re: oliverw · lore

Re: GIT over ssh with identity file

oliverw <oliver@weichhold.com> writes:
Show 7 quoted lines
> Forgive me if this has been answered before. I've searched everywhere but
> couldn't find a solution.
>
> Is it somehow possible to pass your private key file to git when working
> over ssh. What I have in mind would be something like this:
>
> git -i /path/to/private/key clone ssh://homer@foo.bar.com/var/git/repos.git 

I think the standard way people use for things like this is something along the lines of...

    $ cat >>$HOME/.ssh/config <<\EOF
    Host homer-at-foo
      Hostname foo.bar.com
      User homer
      IdentityFile ~/.ssh/homer-at-foo.pub
    EOF
    $ git clone homer-at-foo:/var/git/repos.git
Matthieu Moy· Feb 4, 2009, 08:50 UTC · re: Junio C Hamano · lore

Re: GIT over ssh with identity file

Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
>     $ cat >>$HOME/.ssh/config <<\EOF
>     Host homer-at-foo
>       Hostname foo.bar.com
>       User homer
>       IdentityFile ~/.ssh/homer-at-foo.pub

(I think you have an extra .pub here, the identity file should be the private key).

-- 
Matthieu
Junio C Hamano· Feb 4, 2009, 09:25 UTC · re: Matthieu Moy · lore

Re: GIT over ssh with identity file

Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 10 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>     $ cat >>$HOME/.ssh/config <<\EOF
>>     Host homer-at-foo
>>       Hostname foo.bar.com
>>       User homer
>>       IdentityFile ~/.ssh/homer-at-foo.pub
>
> (I think you have an extra .pub here, the identity file should be the
> private key).

Yeah, you are right. I am too tired and should have gone to bed 90 minutes ago.

← back to recent threads