歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 系統重裝後如何重新pull自己GitHub上的倉儲

系統重裝後如何重新pull自己GitHub上的倉儲

日期:2017/2/28 14:35:49   编辑:Linux教程

由於系統重起了,當然本地的倉儲和SSH生成的密鑰就都沒有了,這時如何在本地pull自己在GitHub上的倉儲呢?

由於系統重裝,~/.ssh文件肯定就沒有了,這時候就需要重新生成公鑰和密鑰,

ssh-keygen -t rsa -C "[email protected]"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 [email protected]
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 [email protected]驗證。輸出

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 建立組織 http://www.linuxidc.com/Linux/2013-08/88197.htm

GitHub Linux下使用方法 http://www.linuxidc.com/Linux/2013-06/86417.htm

Windows下Eclipse搭建GitHub開發環境圖文教程 http://www.linuxidc.com/Linux/2013-06/85372.htm

R語言 3.0.1 源碼已經提交到 GitHub http://www.linuxidc.com/Linux/2013-05/84425.htm

從GitHub將Maven項目導入Eclipse4.2 http://www.linuxidc.com/Linux/2013-04/83082.htm

Copyright © Linux教程網 All Rights Reserved