Can i push into two remote repository in the same command line?

谁说胖子不能爱 提交于 2021-02-17 05:06:14

问题


I want to push and syncronize my code in two different remote repository, to Gitlab and Github at the same command, is it possible?


回答1:


Let's me recommend this push-to-all-remotes alias:

git config [--global] alias.push-to-all-remotes '!git remote | xargs -I% -n1 git push %'

Usage: git push-to-all-remotes master.

Taken from gitalias.com (full disclosure: I'm a contributor there).




回答2:


Yes. Just define two remotes for your working copy:

git remote add lab https://gitlab.com/...
git remote add hub https://github.com/...

Push takes a repository as a parameter:

git push lab master
git push hub master


来源:https://stackoverflow.com/questions/55925944/can-i-push-into-two-remote-repository-in-the-same-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!