添加ssh密钥失败

时间:2016-03-05 18:44:45

标签: git ubuntu ssh

我正在尝试配置git。

我首先使用rm -rf ~./git删除了完整的git目录。

然后使用以下命令添加我的帐户和电子邮件

git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"

在此之后,我按照link添加了ssh密钥。

即使在我去克隆任何应用程序之后遵循所有这些,我也会收到以下错误

Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

创建SSH配置文件

  

如果您有多个身份文件,请创建SSH配置文件机制,以便为各种身份创建别名。

     

您可以使用许多参数和不同方法构建SSH配置文件。

     

此示例中使用的别名条目的格式为:

<html ng-app="ionicApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Ionic Template</title>
    <link href="http://code.ionicframework.com/1.0.0-beta.2/css/ionic.css" rel="stylesheet">
    <script src="http://code.ionicframework.com/1.0.0-beta.2/js/ionic.bundle.js">
    </script>
  </head>
  <body ng-controller="Controller1">
    </ion-content>
     <div>
         <select ng-model="first" ng-options="letter for letter in firstList "></select> 
         <select ng-model="second" ng-options="letter for letter in secondList "></select> 
         <button class="button button-small button-positive" ng-click="set(first,second)">Store these options in a service</button>
     </div>
    </ion-content>
  </body>
</html>
     

要为两个身份(workid和personalid)创建配置文件,您可以执行以下操作:

Host alias 
  HostName bitbucket.org 
  IdentityFile ~/.ssh/identity

如果您没有配置文件,请创建一个。
为每个标识组合添加别名,例如:

Open a terminal window.
Edit the ~/.ssh/config file. 

注意:

您还需要将密钥添加到服务器用户帐户。