简体   繁体   English

Git:如何为给定存储库设置非标准私有 SSH 密钥路径

[英]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.

相关问题 使用SSH密钥的JetBrains(IntelliJ,PhpStorm,WebStorm ...)私有git存储库 - JetBrains (IntelliJ, PhpStorm, WebStorm …) private git repository with SSH key 如何将 SSH 私钥添加到 Intellij for Git - How to add SSH Private Key to Intellij for Git 如何使用私钥克隆GIT存储库 - How to clone GIT repository with private key 在linux上为git私有SSH密钥设置自定义路径 - Setting a custom path for git private SSH key on linux 在哪里为Weblate放置一个私人git存储库,以及如何通过ssh引用它? - Where to put a private git repository for Weblate and how to reference it via ssh? 如何根据给定的ssh key限制git SSH访问 - How to restrict git SSH access based on ssh key given Jenkins 管道中的 Git 使用错误的 SSH 私钥推回 Git 存储库 - Git from Jenkins pipeline is using wrong SSH private key to push back into Git repository 如何在Windows计算机上设置私有GIT存储库,并使用SourceTree和Bitvise SSH Server从Mac访问它? - How do I set up a private GIT repository on a Windows machine and access it from a Mac using SourceTree and Bitvise SSH Server? 如何通过ssh协议来缩短或隐藏git仓库的绝对路径? - How to short or hide the git repository's absolute path by ssh protocol? 如何将 (ssh) 密钥添加到 IBM Bluemix DevOps Services 的 git 存储库? - How to add (ssh) key to IBM Bluemix DevOps Services' git repository?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM