kek
kek

Reputation: 57

Git: how to set not standard private SSH key path for a given repository

I have a problem pushing to my Gitlab account via SSH, since I moved the key pair in the different folder.

Consequently after pushing in the remote I got an "access denied" error, which I assume is connected to the fact that ssh tries to use standard id_rsa in .ssh folder.

Here, I found a way to clone repo using non-standard path to the private SSH key. Now I want to make it default for a given repo using (from Git-scm):

git config core.sshCommand='ssh -i path/to/the/key/privatkeyfilename'

I get and error:

invalid key: core.sshCommand=ssh -i path/to/the/key/privatkeyfilename

Am I doing something wrong? How to achieve this?

Upvotes: 3

Views: 1105

Answers (1)

I think you remove =. You could use following correction.

git config core.sshCommand 'ssh -i path/to/the/key/privatkeyfilename'

Upvotes: 8

Related Questions