git remote
远程仓库
git remote -v #查看远程仓库
git remote add [-t <branch>] [-m ] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <URL> #新增远程仓库连接
git remote remove <name> #删除一个远程仓库
git remote set-url [--push] <name> <newurl> [<oldurl>] #更改远程仓库的地址
推送多个远程仓库
方法一: 配置多个远程仓库
git remote add origin https://github.com/yourname/repo.git
git remote add backup https://gitee.com/yourname/repo.git
git push origin main
git push backup main
git remote add backup https://gitee.com/yourname/repo.git
git push origin main
git push backup main
方法二: 一个远程名,多 URL(自动同时推送
git remote set-url --add origin https://github.com/yourname/repo.git
git remote set-url --add origin https://gitee.com/yourname/repo.git
git push origin main
git remote set-url --add origin https://gitee.com/yourname/repo.git
git push origin main
方法三: 只为 push 设置多个 URL
git remote set-url --push --add origin https://github.com/yourname/repo.git
git remote set-url --push --add origin https://gitee.com/yourname/repo.git
git remote set-url --push --add origin https://gitee.com/yourname/repo.git