Git学习之Git如何提交到两个远程仓库
1.在工程目录下面鼠标右键打开Git Bash Here,在命令行输入git init
2.输入git init后会出现一个.git的一个文件夹
3.然后准备两个远程,我用的一个是github,一个是码云的(第一种方法)
#添加github git remote add github https://github.com/YangXiaoYoung/demo #添加码云 git remote add gitee https://gitee.com/Yang_Young/demo #提交的时候要add,commit git add . git commit -m "first commit" #提交到github git push github master(分支名) #提交到码云 git push gitee master(分支名)
4.还有一种方式也是可以提交上去的(第二种方法)
#添加一个remote,这里是all,也可以是别的名字 git remote add all https://github.com/YangXiaoYoung/demo #再添加另外一个,如果有多个,按照下面这一个命令进行添加. git remote set-url --add all https://gitee.com/Yang_Young/demo #提交的时候要add,commit git add . git commit -m "first commit" git push all --all