有的时候,我们一个项目需要绑定多个远程库,可是该项目已绑定一个远程库了,此时我们可以用 git remote
命令对该项目再添加一个远程库
格式: git remote add 新加远程库名字
git_clone的ssh链接
如: git remote add cicd git@10.0.122.38:root/docker-compose-cicd.git
cicd:为新加远程库的名字 (为push时加以区分)
git@10.0.122.38:root/docker-compose-cicd.git: clone远程库的ssh链接
此时查看该项目下的隐藏文件夹.git下的config配置文件,可发现此时增加了[remote "cicd"]绑定了新加的远程仓库cicd
172.38.0.2: gitlab容器的ip

注意: 在绑定新加远程库push时可能会报错,报错内容如下,造成的原因是由于版本不一致,远程库中已有内容,此时可使用pull将远程库内容拉下来,再push



网友评论