配置多个远程库地址, 多次推送
$ git remote --verbose
origin https://gitee.com/yuanjiaqiang_335/cloud-web.git (fetch)
origin https://gitee.com/yuanjiaqiang_335/cloud-web.git (push)
可以看到目前仅有 http://admin@www.thksoft.net:9461/r/cloud/cloud-web.git 这个远程库地址
我们来加一个 gitee 的远程地址, 首先在 gitee 建好同步仓库, 然后我们在本地添加一个新的远程库地址:
$ git remote add https://gitee.com/yuanjiaqiang_335/cloud-web.git
添加完成后我们查看一下:
$ git remote --verbose
giteeorigin https://gitee.com/yuanjiaqiang_335/cloud-web.git (fetch)
giteeorigin https://gitee.com/yuanjiaqiang_335/cloud-web.git (push)
origin http://admin@www.thksoft.net:9461/r/cloud/cloud-web.git (fetch)
origin http://admin@www.thksoft.net:9461/r/cloud/cloud-web.git (push)
可以查看到以下2个远程库地址:
- giteeorigin: 是我们新加的 gitee 的远程库地址
- origin: 是我们之前在 github 的远程库地址
接下来同步:
git add .
git commit -m "add gitee"
git push -u origin master
git push -u giteeorigin master
如果git push -u
报错,就用git push -f