git clone 和git fetch
时间: 2024-01-26 08:14:38 浏览: 111
git clone是用于将远程仓库克隆到本地的命令,支持多种协议,包括HTTP(s)、SSH、Git、本地文件协议等。下面是一些git clone的例子:
1. 克隆使用HTTP(s)协议的远程仓库:
```shell
git clone http[s]://example.com/path/to/repo.git/
```
2. 克隆使用SSH协议的远程仓库:
```shell
git clone ssh://example.com/path/to/repo.git/
```
3. 克隆使用Git协议的远程仓库:
```shell
git clone git://example.com/path/to/repo.git/
```
4. 克隆本地文件协议的仓库:
```shell
git clone /opt/git/project.git
```
5. 克隆使用file协议的远程仓库:
```shell
git clone file:///opt/git/project.git
```
6. 克隆使用FTP(s)协议的远程仓库:
```shell
git clone ftp[s]://example.com/path/to/repo.git/
```
7. 克隆使用rsync协议的远程仓库:
```shell
git clone rsync://example.com/path/to/repo.git/
```
而git fetch是用于从远程仓库获取最新的提交和分支信息,但不会自动合并到本地分支。如果要同步远程库到你的工作,可以运行以下命令:
```shell
git fetch origin
```
阅读全文
相关推荐


















