如何将ssh密钥路径添加到git命令终端 [英] How to add ssh key path to a git command terminal
问题描述
问题是我没有远程服务器的root权限,并且由于同样的问题而无法使用默认的ssh密钥位置,即使它们是针对用户的,我目前使用的目标是OFF LIMITS。
我发现我可以在自定义文件夹中创建一个ssh,现在我似乎无法找到将其传递给git的方法。为了说清楚我不能编辑配置文件,也不能使用任何root命令。
可能有类似于 git -i ssh / path
但我似乎无法找到关于此问题的任何文档,因为我知道这可能甚至不可能。
如果有人找到了解决方案,任何指导都将非常感谢!
编辑:解决方案
使用环境变量 GIT_SSH
来改变Git使用的ssh命令并指定私钥文件的路径:
GIT_SSH ='ssh -i / home / user / id_rsa'
The thing is that I do not have root permissions on the remote server and can't use the default ssh key location due to the same problem, even if they are for the user I am currently using the destination is OFF LIMITS.
I have found out I can create an ssh in a custom folder now I can't seem to find a way to pass that to git. To make it clear I can't edit the config file nor can I use any root commands.
There might be something like git -i ssh/path
but I can't seem to find any documentation on this issue, for all I know this might not be even possible.
If anyone has found a solution to this any guidance is greatly appreciated!
EDIT : SOLUTION
Git clone with custom SSH using GIT_SSH error
Use the environment variable GIT_SSH
to alter the ssh command that Git uses and specify the path to the private key file:
GIT_SSH='ssh -i /home/user/id_rsa'
这篇关于如何将ssh密钥路径添加到git命令终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!