linux系统 git拉取代码
时间: 2023-10-26 09:06:48 浏览: 112
要在Linux系统下拉取代码,你可以按照以下步骤操作:
1. 首先,在终端中创建一个新的文件夹,可以使用命令`mkdir`,比如:
```
mkdir digist
```
2. 接下来,初始化Git仓库,可以使用命令`git init`:
```
git init
```
3. 然后,与原始的Git仓库建立连接,使用命令`git remote add origin <仓库地址>`,其中<仓库地址>是你要拉取代码的远程仓库的URL:
```
git remote add origin <仓库地址>
```
4. 之后,从远程的`master`分支同步到本地的Git分支,使用命令`git fetch origin master`:
```
git fetch origin master
```
5. 然后,将代码拉取下来,使用命令`git pull origin master`:
```
git pull origin master
```
6. 如果你想查看远程和本地分支以及当前所在分支,可以使用命令`git branch -a`:
```
git branch -a
```
7. 如果你想切换到远程的`test`分支并将其作为本地的`test`分支,可以使用命令`git checkout -b test origin/test`:
```
git checkout -b test origin/test
```
8. 最后,你可以使用命令`git config user.name`和`git config user.email`来查看当前Git的用户名和邮箱:
```
git config user.name
git config user.email
```
以上是在Linux系统下拉取代码的步骤。你可以按照这些步骤来操作。
阅读全文
相关推荐


















