Configurar directorio local remota múltiples repositorio Git

Escenario uno: diferentes bibliotecas de cada tirón / push

1. Configuración del comando git

# 添加
git remote add 名字 仓库地址

# 查看远程仓库
git remote -v 
# origin    仓库地址 (fetch)
# origin    仓库地址 (push)
# 名字    仓库地址 (fetch)
# 名字    仓库地址 (push)

# 删除
git remote remove 名字

2. Modificar el archivo .git / config

[remote "origin"]
        url = 仓库地址
        fetch = +refs/heads/*:refs/remotes/origin/*
[remote "名字"]
        url = 仓库地址
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        remote = 名字
        merge = refs/heads/master
        rebase = true

3. Operación

git pull/push origin [分支]
git pull/push 名字 [分支]

El valor por defecto es el almacén de origen

Escenario 2: diferente biblioteca una vez empuje

1. Configuración del comando git

# 添加
git remote set-url --add origin 仓库地址

# 查看远程仓库
git remote -v 
# origin    仓库地址1 (fetch)
# origin    仓库地址1 (push)
# origin    仓库地址2 (push)

# 删除
git remote set-url --delete origin 仓库地址

2. Modificar el archivo .git / config

[remote "origin"]
        url = 仓库地址1
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = 仓库地址2
[branch "master"]
        remote = origin
        merge = refs/heads/master
        rebase = true

3. Operación

git push [分支]

El tiempo predeterminado tirón Almacén dirección 1

Supongo que te gusta

Origin www.cnblogs.com/YYRise/p/12460020.html
Recomendado
Clasificación