[英]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.我在通过 SSH 推送到我的 Gitlab 帐户时遇到问题,因为我将密钥对移到了不同的文件夹中。
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.因此,在推入遥控器后,我收到了“访问被拒绝”错误,我认为这与 ssh 尝试使用标准 id_rsa in.ssh 文件夹这一事实有关。
Here , I found a way to clone repo using non-standard path to the private SSH key. 在这里,我找到了一种使用私有 SSH 密钥的非标准路径来克隆 repo 的方法。 Now I want to make it default for a given repo using (from Git-scm ):现在我想使用(来自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?如何做到这一点?
I think you remove =
.我想你删除=
。 You could use following correction.您可以使用以下更正。
git config core.sshCommand 'ssh -i path/to/the/key/privatkeyfilename'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.