由於系統重起了,當然本地的倉儲和SSH產生的密鑰就都沒有了,這時如何在本地pull自己在GitHub上的倉儲呢?
由於系統重裝,~/.ssh檔案肯定就沒有了,這時候就需要重建公開金鑰和密鑰,
ssh-keygen -t rsa -C "your_email@example.com"Generating public/private rsa key pair.
Enter file in which to save the key (/home/XXX/.ssh/id_rsa):
Created directory '/home/XXX/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/XXX/.ssh/id_rsa.
Your public key has been saved in /home/XXX/.ssh/id_rsa.pub.
The key fingerprint is:
79:3c:8c:e7:3e:57:8a:59:36:4d:4c:09:59:d3:8b:df your_email@example.com
The key's randomart image is:
+--[ RSA 2048]----+
| .+oo |
| . o..|
| o. .|
| = .o. |
| S * o. .|
| + .+ o.E|
| .= + |
| .+ o |
| .o |
+-----------------+
需要輸入時直接enter,命令列中的郵箱是你在GitHub上留的郵箱,這樣就組建類型為rsa的金鑰組。然後把id_rsa.pub裡的公開密鑰拷貝到GitHub上即可。Account Setting—>SSH Keys—>Add SSH Key即可。最後用ssh -T git@github.com驗證。輸出
Hi XXX! You've successfully authenticated, but GitHub does not provide shell access.即說明設定成功。
其實這些都跟正題沒有什麼關係,設定SSH只是訪問GitHub的一種方式,平常我們使用http的方式是最多的,言歸正傳,當我們需要GitHub上的倉儲時,我們建立一個檔案夾,首先git init初始化git,然後git pull https://github.com/XXX/Snake.git,這樣就會把倉儲拷貝下來,這樣就可以操作了。
推薦閱讀:
如何在 GitHub 建立組織
GitHub Linux下使用方法
Windows下Eclipse搭建GitHub開發環境圖文教程
R語言 3.0.1 源碼已經提交到 GitHub
從GitHub將Maven項目匯入Eclipse4.2