1. 程式人生 > >GIT學習----第十節:克隆遠端庫

GIT學習----第十節:克隆遠端庫

學習目的

  1. 如何從建立好的遠端庫進行克隆?

建立遠端庫

步驟和GIT學習----第九節:新增遠端庫中建立遠端庫一樣,唯一區別就是需要填寫倉庫名後,勾選Initialize this repository with a README。這樣建立完成後就會自動給我們生成一個README.md檔案。當然你也可以不讓他自動建立,你自己手動建立。

克隆遠端庫到本地

  1. 克隆遠端庫的命令?克隆一個已存在的遠端庫GetPeriod到本地。
$ git clone [email protected]:Rattenking/GetPeriod.git
Cloning into 'GetPeriod'...
remote: Enumerating objects: 54, done.
remote: Total 54 (delta 0), reused 0 (delta 0), pack-reused 54
Receiving objects: 100% (54/54), 12.55 KiB | 54.00 KiB/s, done.
Resolving deltas: 100% (20/20), done.
  1. 檢視庫中檔案?檢視該庫中的檔案有哪些。
1. $ cd GetPeriod

2. $ ls
app.js  app.json  app.wxss  pages/  project.config.json  README.md  utils/

我們可以看出在GetPeriod資料夾下有app.js、app.json、app.wxss、project.config.json、README.md檔案;有pages/和utils/資料夾。

Git支援多種協議

  1. https
  1. ssh

[email protected]:Rattenking/GetPeriod.git

區別:1、https除了速度慢以外,還有個最大的麻煩是每次推送都必須輸入口令(在某些只開放http埠的公司內部就無法使用ssh協議而只能用https)。2、ssh支援的原生git協議速度最快。

總結

  1. 克隆遠端庫命令:git clone [email protected]:path/repo-name.git;
  2. git的協議區別:https速度慢,每次推送都必須輸入口令;ssh速度最快。

其他

QQ交流群: 264303060

QQ交流群

遊戲列表