Andy's Cafe

Magit: Multiple Push Remotes

Last updated :

I wanted to do the equivalent of this, but in magit

git remote rename origin github

git remote add codeberg https://codeberg.org/jkreeftmeijer/ox-md-title.el.git
git remote add origin https://codeberg.org/jkreeftmeijer/ox-md-title.el.git

git remote set-url --add --push origin https://codeberg.org/jkreeftmeijer/ox-md-title.el.git
git remote set-url --add --push origin https://github.com/jeffkreeftmeijer/ox-md-title.el

git remote show origin

* remote origin
  Fetch URL: https://codeberg.org/jkreeftmeijer/ox-md-title.el.git
  Push  URL: https://codeberg.org/jkreeftmeijer/ox-md-title.el.git
  Push  URL: https://github.com/jeffkreeftmeijer/ox-md-title.el
  HEAD branch: main
  Remote branch:
    main new (next fetch will store in remotes/origin)
  Local ref configured for 'git push':
    main pushes to main (up to date)

Source

Renaming was easy:

Adding another remote was also simple:

Adding origin back in was just:

Setting multiple push remotes took bit of work to figure out. Ultimately, you just give it a comma-space separated list of push URLs:

Last thing was setting the push remote default back to origin:

Reply via email

Tags

#emacs   #magit