Lucas Marinzeck
Lucas Marinzeck

Reputation: 343

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

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

Upvotes: 1

Views: 93

Answers (2)

phd
phd

Reputation: 94417

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).

Upvotes: 4

choroba
choroba

Reputation: 241808

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

Upvotes: 5

Related Questions