github配置密鑰SSH keys

當(dāng)你github創(chuàng)建了一個(gè)倉庫后,關(guān)聯(lián)本地文件,可能出現(xiàn)以下情況:

  • 初始化
$ git commit -m "init page"
[master (root-commit) d832761] init page
 1 file changed, 7 insertions(+)
 create mode 100644 index.html
  • 關(guān)聯(lián)本地文件
$ git remote add origin git@github.com:xxxxx/xxxxx.github.io.git
  • remote遠(yuǎn)程
$ 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.
  • 這是因?yàn)楸緳C(jī)沒有給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.           |
+-----------------+
  • 根據(jù)路徑找到id_rsa.pub文件,復(fù)制里面的內(nèi)容,粘貼到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.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,506評(píng)論 19 139
  • 第一章 安裝Git工具 下載GitHub for Windows,直接點(diǎn)擊安裝,安裝完成后,可以看到“Git Sh...
    不圓的石頭閱讀 12,124評(píng)論 5 63
  • 一、創(chuàng)建github repository(倉庫) 1-1 登錄github github的官方網(wǎng)址:https:...
    字短情長閱讀 1,561評(píng)論 0 0
  • 作為一個(gè)農(nóng)村的大學(xué)生,我深知走到今天的諸般不易,倒不是說我自己很難。我家里對(duì)讀書是十分重視的,但一路過來見到了許多...
    halo方三閱讀 353評(píng)論 3 1
  • 股息增長模型 內(nèi)部收益率:用證券的當(dāng)前價(jià)格P代替V,用K*(內(nèi)部收益率)替換k,進(jìn)行轉(zhuǎn)換,可得 零增長模型的應(yīng)用受...
    Jimmy_9f9d閱讀 727評(píng)論 0 1

友情鏈接更多精彩內(nèi)容