---
title: "GIT设置默认REMOTE地址方法"
author: "Andy_Dou"
date: "2014-05-27T16:45:34Z"
tags: []
categories: ["开源软件"]
slug: "git-remote"
draft: false
lastmod: "2014-05-27T16:45:34Z"
id: 2072203
url: "https://ideabean.iteye.com/blog/2072203"
---

1\. 如果你的GIT设置了多个remote地址，在不同的remote间pull方法为：

```
$ git pull <remote_name> <branch_name>
```

 

2\. 每次都需要输入 remote name 和 branch name 比较麻烦，我们可以将某个remote 设置为默认

设置方法：

```
$ git config branch.master.remote <remote origin>

$ git config branch.master.merge refs/heads/master
```

 

3\. 也可以直接通过修改git的配置文件进行设置。(工程所在.git目录)

```
$ vi .git/config
```

 

4\. 如果需要对所有的项目都进行设置可以使用 --global 参数，进行设置。