如何使用密码将ssh添加到远程服务器

时间:2018-10-19 17:07:15

标签: git ssh-agent

我需要在远程服务器上执行git命令,并且我有一个带有密码短语的私钥。我该如何ssh-add密钥到服务器,以便我可以在其中运行git命令而无需在其中复制私钥?我为此进行了大量搜索,但没有找到可以回答此问题的页面。

1 个答案:

答案 0 :(得分:0)

您必须将公钥 内容放在服务器上的Sub GreenShield() Dim wb As Workbook Dim ws As Worksheet Dim IE: Set IE = CreateObject("InternetExplorer.Application") Dim XMLReq As New MSXML2.XMLHTTP60 Set wb = ThisWorkbook Set ws = wb.Sheets("Data") 'OPEN INTERNET EXPLORER IE.Visible = True IE.navigate "https://www.surehealth.ca/#!/summary" Wait_IE IE DropDown IE End Sub Sub DropDown(IE, className, nameAttr, nameValue, DropValue) Dim HTMLDoc: Set HTMLDoc = IE.document Dim DropList As MSHTML.IHTMLElement Dim Drops As MSHTML.IHTMLElementCollection Dim Drop As MSHTML.IHTMLElement Set DropList = HTMLDoc.getElementsByClassName("ng-scope")(0) Set Drops = DropList.getElementsByTagName("li") For Each Drop In Drops If Drop.getAttribute("ng-repeat") = "n in options.CoverageType" Then Debug.Print Drop.tagName; Drop.innerText If Drop.innerText = "Myself" Then Drop.Click Wait_IE IE End If End If Next End Sub Sub Wait_IE(ByRef IE) Dim Started As Single: Started = Timer Dim i: i = 0 While (i < 10) Or (IE.readyState <> 3 And IE.readyState <> 4) Do: DoEvents: Loop Until Timer - Started >= 1 Do While IE.readyState <> READYSTATE_COMPLETE Loop i = i + 1 Wend End Sub 中(该文件可以容纳来自不同人的许多密钥)。然后,您可以使用ssh-add提供您的私钥,以便在与服务器一起使用ssh时可以使用它。...,或者在使用ssh提供私钥文件时可以使用-i。