用Git从GitHub上下载源码

参考博客:https://www.baidu.com/link?url=kVFCl0_ie967mbNRD-UqQI5cZBCpOSvYd7iIGfMtko_f5upZXbEsO2-HcGUCFFa7HpPQKxrQ9eQUs380B6tguaURBAnUjt7F7FI9hYn27Ce&wd=&eqid=d4489b450000307a000000025b04255c

本文根据参考资料[1]的提示,以下载Vim的YouCompleteMe插件源码为例进行说明如何使用Git从GitHub中下载源码,实验环境为Ubuntu16.04。

1 确定源码地址

YouCompleteMe在GitHub中的主页如下图所示:


    由上图可见,网址为:https://github.com/Valloric/YouCompleteMe,可以通过这个网址来下载YouCompleteMe:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone https://github.com/Valloric/YouCompleteMe  
    也可以在用单引号将网址括住,效果是一样的:


[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone 'https://github.com/Valloric/YouCompleteMe'  

    也可以将https改为git,例如:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone git://github.com/Valloric/YouCompleteMe  

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone 'git://github.com/Valloric/YouCompleteMe'  

    通过上述命令可将YouCompleteMe源码下载到当前目录中。

2 递归下载子目录源码

    通过上述命令下载的YouCompleteMe的third_party/ycmd目录是空的,但是通过上图的源码浏览查看ycmd目录并不是空的,因此说明上述命令并没有下载完整所有的源码。根据YouCompleteMe的安装提示进行安装时提示:


    因此先进入YouCompleteMe目录,然后执行如下命令即可递归下载所有子目录的源码了。

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git submodule update --init --recursive  

    或者,在下载的时候就指定--recursive参数:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone --recursive git://github.com/Valloric/YouCompleteMe  

猜你喜欢

转载自blog.csdn.net/qq_34638161/article/details/80412930