SoureTree Github 克隆项目时报错 Error: Permission denied (publickey)

本文主要是介绍SoureTree Github 克隆项目时报错 Error: Permission denied (publickey),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

      • step1 你可以用下面的命令验证你的连接是否正常
      • step2 确保你有一个正在使用的key
      • step3 生成新的SSH key
      • step4 将你的SSH key加入到ssh-agent里面

这种错误一般代表服务器拒绝了你的连接请求。可能会有很多原因,最常见的🌰是下面这些。

step1 你可以用下面的命令验证你的连接是否正常

$ ssh -T git@github.com
> Hi username! You've successfully authenticated...

如果你是被denied的状态,就显示是denied

step2 确保你有一个正在使用的key

验证你是否生成过私钥并且把它加载进了SSH,

  • 如果你正在使用OpenSSH 6.7 or 更老版本,并已生成并加载过私钥:
# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add -l
> 2048 a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d /Users/you/.ssh/id_rsa (RSA)
  • 如果你正在使用OpenSSH 6.8 or 更新版本,并已生成并加载过私钥:
# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add -l -E md5
> 2048 MD5:a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d /Users/you/.ssh/id_rsa

我在这碰到的情况,可能是之前生成的私钥被下载的🐧的mac管理软件删除了(猜测的,因为没找到)

step3 生成新的SSH key

复制一下文本到你的termial中,用你自己的github email地址替换里面的email地址

#This creates a new ssh key, using the provided email as a label.
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
> Generating public/private rsa key pair.
#When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.> Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
#At the prompt, type a secure passphrase(密码).> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

在这,我设置的密码都是和macbook登陆一样的密码,方便记忆

step4 将你的SSH key加入到ssh-agent里面

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key. When adding your SSH key to the agent, use the default macOS ssh-add command, and not an application installed by macports, homebrew, or some other external source.
在将新的SSH密钥添加到ssh-agent来管理密钥之前,您应该已经检查了现有的SSH密钥并生成了一个新的SSH密钥。将SSH密钥添加到代理agent时,请使用默认的macOS ssh-add命令,而不要使用macports, homebrew, 或其他外部源安装的应用程序。

  1. Start the ssh-agent in the background.
$ eval "$(ssh-agent -s)"
> Agent pid 59566
  1. 如果您使用的是macOS Sierra 10.12.2或更高版本,则需要修改〜/ .ssh / config文件,以将密钥自动加载到ssh-agent中并将密码短语存储在密钥链中。
  • 这里我发现我的mac里面没有这个config文件,我就直接vi新建了一个,粘贴了下面的内容进去。
Host *AddKeysToAgent yesUseKeychain yesIdentityFile ~/.ssh/id_rsa
  1. Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
    将SSH私钥添加到ssh-agent,并将密码存储在钥匙串中。如果您使用其他名称创建密钥,或者要添加具有其他名称的现有密钥,请使用自己命名的名称替换命令中的id_rsa。
$ ssh-add -K ~/.ssh/id_rsa
  1. 将SSH key添加到你的 GitHub 账户中.
    在这里插入图片描述
    在这里插入图片描述

这篇关于SoureTree Github 克隆项目时报错 Error: Permission denied (publickey)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/637722

相关文章

#error用法

/* *检查编译此源文件的编译器是不是C++编译器 *如果使用的是C语言编译器则执行#error命令 *如果使用的是 C++ 编译器则跳过#error命令 */ #ifndef __cplusplus #error 亲,您当前使用的不是C++编译器噢! #endif #include <stdio.h> int main() {

用Microsoft.Extensions.Hosting 管理WPF项目.

首先引入必要的包: <ItemGroup><PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /><PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" /><PackageReference Include="Serilog

eclipse运行springboot项目,找不到主类

解决办法尝试了很多种,下载sts压缩包行不通。最后解决办法如图: help--->Eclipse Marketplace--->Popular--->找到Spring Tools 3---->Installed。

vue项目集成CanvasEditor实现Word在线编辑器

CanvasEditor实现Word在线编辑器 官网文档:https://hufe.club/canvas-editor-docs/guide/schema.html 源码地址:https://github.com/Hufe921/canvas-editor 前提声明: 由于CanvasEditor目前不支持vue、react 等框架开箱即用版,所以需要我们去Git下载源码,拿到其中两个主

React+TS前台项目实战(十七)-- 全局常用组件Dropdown封装

文章目录 前言Dropdown组件1. 功能分析2. 代码+详细注释3. 使用方式4. 效果展示 总结 前言 今天这篇主要讲全局Dropdown组件封装,可根据UI设计师要求自定义修改。 Dropdown组件 1. 功能分析 (1)通过position属性,可以控制下拉选项的位置 (2)通过传入width属性, 可以自定义下拉选项的宽度 (3)通过传入classN

brew install opencv@2 时报错 Error: Can't create update lock in /usr/local/var/homebrew/locks!

解决方案,报错里已经说明了: 我的解决方案: sudo chown -R "$USER":admin /usr/local   stackoverflow上的答案 I was able to solve the problem by using chown on the folder: sudo chown -R "$USER":admin /usr/local Also you'

vue3项目将所有访问后端springboot的接口统一管理带跨域

vue3项目将所有访问后端springboot的接口统一管理带跨域 一、前言1.安装Axios2.创建Axios实例3.创建API服务文件4.在组件中使用API服务 二、跨域三、总结 一、前言 在Vue 3项目中,统一管理所有访问后端Spring Boot接口的最佳实践是创建一个专门的API服务层。这可以让你的代码更加模块化、可维护和集中管理。你可以使用Axios库作为HTT

vscode-创建vue3项目-修改暗黑主题-常见错误-element插件标签-用法涉及问题

文章目录 1.vscode创建运行编译vue3项目2.添加项目资源3.添加element-plus元素4.修改为暗黑主题4.1.在main.js主文件中引入暗黑样式4.2.添加自定义样式文件4.3.html页面html标签添加样式 5.常见错误5.1.未使用变量5.2.关闭typescript检查5.3.调试器支持5.4.允许未到达代码和未定义代码 6.element常用标签6.1.下拉列表

局域网内vue2 配置本地IP地址访问项目

在日常开发中同事可能需要访问你的前端项目,可以通过配置实现通过ip访问 一.首先找到config文件夹目录下的 index.js文件             将此处的host的值修改为0.0.0.0(即 host: 0.0.0.0) // Various Dev Server settings//host: 'localhost' //将localhost进行替换成 0.0.0.0host:

BD错误集锦8——在集成Spring MVC + MyBtis编写mapper文件时需要注意格式 You have an error in your SQL syntax

报错的文件 <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.yuan.dao.YuanUserDao"><!