05 Git远程操作
Git远程操作 Git有很多优势,其中之一就是远程操作非常简便。本文详细介绍5个Git命令,它们的概念和用法,理解了这些内容,你就会完全掌握Git远程操作。 git clone git remote git fetch git pull git push 一、git clone 远程操作的第一步,通常是从远程主机克隆一个版本库,这时就要用到git clone命令。 $ git clone <版本库的网址> 比如,克隆jQuery的版本库。 $ git clone https://github.com/jquery/jquery.git 该命令会在本地主机生成一个目录,与远程主机的版本库同名。如果要指定不同的目录名,可以将目录名作为git clone命令的第二个参数。 $ git clone <版本库的网址> <本地目录名> git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。 $ git clone http [ s ] ://example.com/path/to/repo.git/ $ git clone ssh://example.com/path/to/repo.git/ $ git clone git://example.com/path/to/repo.git/ $ git clone /opt/git