Skip to content

Instantly share code, notes, and snippets.

@marcelosantos
Last active May 15, 2017 13:10
Show Gist options
  • Save marcelosantos/5331ae076071e9d52059090b29100032 to your computer and use it in GitHub Desktop.
Save marcelosantos/5331ae076071e9d52059090b29100032 to your computer and use it in GitHub Desktop.
Adicionando dois origin para o mesmo repositório git

So let's add a new remote called all that we'll reference later when pushing to multiple repositories:

$ git remote add all git://original/repo.git
$ git remote -v
all git://original/repo.git (fetch)               <-- ADDED
all git://original/repo.git (push)                <-- ADDED
origin  git://original/repo.git (fetch)
origin  git://original/repo.git (push)
$ git config -l | grep '^remote\.all'
remote.all.url=git://original/repo.git            <-- ADDED
remote.all.fetch=+refs/heads/*:refs/remotes/all/* <-- ADDED

Then let's add a pushurl to the all remote, pointing to another repository:

$ git remote set-url --add --push all git://another/repo.git
$ git remote -v
all git://original/repo.git (fetch)
all git://another/repo.git (push)                 <-- CHANGED
origin  git://original/repo.git (fetch)
origin  git://original/repo.git (push)
$ git config -l | grep '^remote\.all'
remote.all.url=git://original/repo.git
remote.all.fetch=+refs/heads/*:refs/remotes/all/*
remote.all.pushurl=git://another/repo.git         <-- ADDED

Based on http://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment