Article directory
background
This article mainly describes that in normal development, when a piece of code may have multiple remote warehouses, it needs to be updated to different warehouses and updated to all warehouses synchronously
1. A set of codes is associated with multiple remote warehouses and updated on demand
1. Create a project folder locally
2. Open the terminal, cd into the project folder, and initialize
git init
3. Add warehouse address
git remote add 仓库名1 仓库地址
git remote add 仓库名2 仓库地址
git remote add 仓库名3 仓库地址
4. Check the associated warehouse address
git remote -v
5.add file
git add .
6.commit
git commit -m"提交版本描述"
7. Submit to the warehouse
git push 仓库名1 master
git push 仓库名2 master
git push 仓库名3 master
8. Pull the code
git pull 仓库名1 master
git pull 仓库名2 master
git pull 仓库名3 master
2. Submit a set of code to all warehouses at one time
1. Delete the rest of the repositories
提示:这里举的例子在上面的基础上修改,也可在关联远程仓库时,跳到第二步
git remote rm 仓库名1
git remote rm 仓库名2
2. Add remote warehouse
提示:这里关联的仓库名称都是一样的
git remote set-url --add 仓库名3 仓库地址1
git remote set-url --add 仓库名3 仓库地址2
3. Check the associated warehouse address
git remote -v .
4. One-time submission
git add .
git commit -m"提交版本描述"
git push 仓库名3 master