github配置密钥SSH keys

当你github创建了一个仓库后,关联本地文件,可能出现以下情况:

  • 初始化
$ git commit -m "init page"
[master (root-commit) d832761] init page
 1 file changed, 7 insertions(+)
 create mode 100644 index.html
  • 关联本地文件
$ git remote add origin git@github.com:xxxxx/xxxxx.github.io.git
  • remote远程
$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 这是因为本机没有给github配置密匙
$ ssh-keygen -t rsa -C 你的邮箱地址
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
2c:03:89:09:5c:4c:2a:b9:2b:bd:ec:2b:a0:ce:ff:22 791273579@qq.com
The key's randomart image is:
+--[ RSA 2048]----+
|o +o             |
| +.+ .           |
|o.o o            |
|..   . .         |
|.     o S        |
|.o     o         |
|= .              |
|=E o             |
|.=Boo.           |
+-----------------+
  • 根据路径找到id_rsa.pub文件,复制里面的内容,粘贴到github的personal settings的SSH keys中

    QQ截图20171010110138.png

  • 再一次push, 输入密码,done

$ git push -u origin master
Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 293 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:xxxxx/xxxxx.github.io.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,973评论 19 139
  • 第一章 安装Git工具 下载GitHub for Windows,直接点击安装,安装完成后,可以看到“Git Sh...
    不圆的石头阅读 11,939评论 5 63
  • 一、创建github repository(仓库) 1-1 登录github github的官方网址:https:...
    字短情长阅读 1,429评论 0 0
  • 作为一个农村的大学生,我深知走到今天的诸般不易,倒不是说我自己很难。我家里对读书是十分重视的,但一路过来见到了许多...
    halo方三阅读 269评论 3 1
  • 股息增长模型 内部收益率:用证券的当前价格P代替V,用K*(内部收益率)替换k,进行转换,可得 零增长模型的应用受...
    Jimmy_9f9d阅读 658评论 0 1