【ASK】git使用中出现Permission denied (publickey).
好久没有用git了,今天突然执行了一下
$git submodule update --init --recursive
===============================
结果出现如下提示
Cloning into 'Submodules/********'...
Permission denied (publickey).
===============================
由于确实好长时间没有摸过git了,一点印象都没有了。没办法,只能google了,还好一搜就得到一片经典官方帮助:
https://help.github.com/articles/generating-ssh-keys/
=================================
Generating SSH keys
SSH keys are a way to identify trusted computers, without involving passwords. The steps below will walk you through generating an SSH key and adding the public key to your GitHub account.
We recommend that you regularly review your SSH keys list and revoke any that haven't been used in a while.
Tip: GitHub has a Mac client! You can use it without ever touching the command line.
Step 1: Check for SSH keys
First, we need to check for existing SSH keys on your computer. Open Terminal and enter:
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following:
- id_dsa.pub
- id_ecdsa.pub
- id_ed25519.pub
- id_rsa.pub
Tip: If you receive an error that the ~/.ssh doesn't exist,, don't worry! We'll create it in Step 2.
Step 2: Generate a new SSH key
With Terminal still open, copy and paste the text below. Make sure you substitute in your GitHub email address.
ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.We strongly suggest keeping the default settings as they are, so when you're prompted to "Enter a file in which to save the key", just press Enter to continue.
# Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
You'll be asked to enter a passphrase.
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]Tip: We strongly recommend a very good, secure passphrase. For more information, see "Working with SSH key passphrases".
After you enter a passphrase, you'll be given the fingerprint, or id, of your SSH key. It will look something like this:
# Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
Step 3: Add your key to the ssh-agent
To configure the ssh-agent program to use the SSH key you've generated:
Ensure ssh-agent is enabled:
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
# Agent pid 59566Add your generated SSH key to the ssh-agent:
ssh-add ~/.ssh/id_rsa
Step 4: Add your SSH key to your account
To configure your GitHub account to use your SSH key:
Copy the SSH key to your clipboard. Keep in mind that your key may also be named id_dsa.pub,id_ecdsa.pub or id_ed25519.pub, in which case you must change the filename as follows:
pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
Warning: It's important to copy the key exactly without adding newlines or whitespace.
Add the copied key to GitHub:
In the top right corner of any page, click .
In the user settings sidebar, click SSH keys.
Click Add SSH key.- In the Title field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
Paste your key into the "Key" field.
Click Add key.- Confirm the action by entering your GitHub password.
Step 5: Test the connection
To make sure everything is working, you'll now try to SSH into . When you do this, you will be asked to authenticate this action using your password, which is the SSH key passphrase you created earlier.
Open Terminal and enter:
ssh -T git@github.com
# Attempts to ssh to GitHubYou may see this warning:
# The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?Verify the fingerprint in the message you see matches the following message, then type
yes:# Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.If the username in the message is yours, you've successfully set up your SSH key!
If you receive a message about "access denied," you can read these instructions for diagnosing the issue.
If you're switching from HTTPS to SSH, you'll now need to update your remote repository URLs. For more information, see Changing a remote's URL.
================================
讲的十分详细,再次感谢一下,一步一步安装文档所说进行,竟然意外的发现以前就在自己的github上已经做过类似的操作了。难道真是上了岁数,忘得一干二净......
【ASK】git使用中出现Permission denied (publickey).的更多相关文章
- git@github.com: Permission denied (publickey).////remote: Permission to xxx/test.git denied to xxx.等权限问题
Error msg git@github.com: Permission denied (publickey) 或者: remote: Permission to xxx/test.git denie ...
- github:当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)解决方案
当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)弹框 图片: 原因:电脑公钥(publickey)未添加至gi ...
- 使用Git出现以下错误"Git@github.com: Permission denied (publickey). Could not read from remote repository."解决方案
转载于:https://blog.csdn.net/dotphoenix/article/details/100130424 git@github.com: Permission denied (pu ...
- git实战中遇到git@github.com: Permission denied (publickey).的问题
一.问题我们在使用git的时候会建立一个私钥和一个公钥来完成彼此的通讯,因此如何使用给一个指令建立一个秘钥至关重要.但是我在实践的过程中出现了git@github.com: Permission de ...
- ubuntu下git clone 出现Permission denied (publickey).
今天在ubuntu上使用git 克隆 github上面的库,一直权限拒绝Permission denied (publickey). 公钥绑了好几次,都不行: 最后怀疑是git配置公钥地址有问题:打开 ...
- centos: git clone提示Permission denied publickey 问题
问题: Initialized empty Git repository in /data1/mouxuan/fastsocket-private/.git/ Permission denied (p ...
- 【git基础】Permission denied (publickey). fatal: Could not read from remote repository
运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...
- IDEA中使用git报错Permission denied (publickey)
最近在使用idea开发时,使用git拉取远程仓库的代码时,报错Permission denied (publickey),原因是因为ssh的密钥失效,必须得重新设置下ssh的密钥即可. 命令很简单,在 ...
- git 时 出现 Permission denied (publickey).
https://blog.csdn.net/awp0011/article/details/73368481 第一次使用github.com在本地 执行 git clone git@github.co ...
随机推荐
- spring下载和安装
下载和安装Spring请按例如以下步骤进行. (1)登录网站,下载Spring的最新稳定版本号.最新版本号为spring-framework-4.0.建议下载spring-framework-sp ...
- android studio教学视频资源(点开即看)
android studio教学视频资源(点开即看) 自从Google推出android studio之后.包含github在内的非常多第三方代码库项目很多其它的採用的android studio编译 ...
- 使用 WinEdt 来写中文文章or 建模论文
找了几乎两个小时…… 后来发现… WinEdt 是可以用来写中文文章的…而并非只能英文文章或演示文稿… \documentclass{article} \usepackage{CJK} \begin{ ...
- [机器学习实战] k邻近算法
1. k邻近算法原理: 存在一个样本数据集,也称作训练样本集,并且样本集中每个数据都存在标签,即我们知道样本集中每一数据与所属分类的对应关系.输入没有标签的新数据后,将新数据的每个特征与样本集中数据对 ...
- .net core 控制台程序使用依赖注入(Autofac)
1.Autofac IOC 容器 ,便于在其他类获取注入的对象 using System; using System.Collections.Generic; using System.Linq; u ...
- git 这一篇就够80%使用情况了
转 Git 命令详解及常用命令整理 Git 命令详解及常用命令 Git作为常用的版本控制工具,多了解一些命令,将能省去很多时间,下面这张图是比较好的一张,贴出了看一下: 关于git,首先需要了解几个名 ...
- Spring Boot(七):spring boot测试介绍
首先maven要引入spring-boot-starter-test这个包. 先看一段代码 @RunWith(SpringRunner.class) @SpringBootTest(webEnviro ...
- Codeforces Round #265 (Div. 2) B. Inbox (100500)
Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others ...
- Atitit. Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Atitit. Exception in thread "main" java.lang.Error: Unresolved compilation problem: 1.1. ...
- atitit.eclipse有多少api 扩展点,以及扩展点的设计
atitit.eclipse有多少api 扩展点,以及扩展点的设计 不赞成使用的.作废的以及内部的扩展点 [扩展]页显示了几个你不应该在你的插件中使用的扩展点.在附表C.1的[描述]栏中,我们使用如 ...