【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 ...
随机推荐
- .htaccess 文件中详细介绍
#如果存在rewrite_module 模块则执行里面的代码 <IfModule rewrite_module> #开启重写机制 RewriteEngine On #告诉apache这里不 ...
- Google 地图 API for Android
原文:Introduction to Google Maps API for Android 作者:Eunice Obugyei 译者:kmyhy 从健康类 app Runkeeper 到游戏 app ...
- TCP协议详解(理论篇)
TCP协议详解(理论篇) 2012-08-20 0个评论 作者:陈立龙 收藏 我要投稿 TCP协议详解(理论篇) 1. 与UDP不同的是,TCP提供了一种面向连接 ...
- CGGeometry Reference
CGRectUnionCGRectUnion接受两个CGRect结构体作为参数并且返回一个能够包含这两个矩形的最小矩形.听起来可能没什么,我相信你也可以用几行代码轻松实现这个功能,不过 CGGeome ...
- docker运行环境安装-centos(一)
在这里我们使用的是docker的社区版Docker CE,针对的是未安装docker的新的主机,如果安装过docker的早期版本,先卸载它们及关联的依赖资源,安装的版本为docker 18.03. 1 ...
- 通过Socket连接一次传输多个文件
近期在做一个通过WIFI在手机之间传输文件的功能.须要在手机之间建立一个持久的Socket 连接并利用该连接数据传输.能够一次传输一个或多个文件. 在一次传输多个文件时,遇到了一个困难:怎样在接收文件 ...
- MS SQL 日常维护管理常用脚本
--[查看数据库服务器名称] --默认实例查询 SELECT @@SERVERNAME AS SERVERNAME; SELECT SERVERPROPERTY('servername') AS Se ...
- 에러 처리 HandleErrorAttribute
ExceptionInfo info = new ExceptionInfo(); info.Success = false; info.Message = filterContext.Excepti ...
- Unity中差乘判断目标是否在左边或右边
使用差乘判断左右一般是比较差乘的y,小于0是左,大于0是右.特殊情况可以用其他分量来比较 默认情况: var cross = Vector3.Cross(lhsObject.transform.pos ...
- DDR 复位
将FPGA代码和实际的数字电路对应起来. always @ (negedge clk_ref_200) begin if(ddr3_init_done) 'b10) 'b10 ...