用Git從GitHub上下載原始碼
阿新 • • 發佈:2019-01-29
本文根據參考資料[1]的提示,以下載Vim的YouCompleteMe外掛原始碼為例進行說明如何使用Git從GitHub中下載原始碼,實驗環境為Ubuntu16.04。
1 確定原始碼地址
YouCompleteMe在GitHub中的主頁如下圖所示:
由上圖可見,網址為:https://github.com/Valloric/YouCompleteMe,可以通過這個網址來下載YouCompleteMe:
- git clone https://github.com/Valloric/YouCompleteMe
-
git clone 'https://github.com/Valloric/YouCompleteMe'
也可以將https改為git,例如:
- git clone git://github.com/Valloric/YouCompleteMe
- git clone 'git://github.com/Valloric/YouCompleteMe'
通過上述命令可將YouCompleteMe原始碼下載到當前目錄中。
2 遞迴下載子目錄原始碼
通過上述命令下載的YouCompleteMe的third_party/ycmd目錄是空的,但是通過上圖的原始碼瀏覽檢視ycmd目錄並不是空的,因此說明上述命令並沒有下載完整所有的原始碼。根據YouCompleteMe的安裝提示進行安裝時提示:
因此先進入YouCompleteMe目錄,然後執行如下命令即可遞迴下載所有子目錄的原始碼了。
- git submodule update --init --recursive
或者,在下載的時候就指定--recursive引數:
- git clone --recursive git://github.com/Valloric/YouCompleteMe
參考資料