Multi Remote

2026-08-07POSSE

I wanted to keep my code in multiple remotes.

  • github since it is still where everyone reaches to see what I'm doing.
  • codeberg since it is my preferred forge.

Apparently git supported multiple remotes for fetch and push, so this is how i configured my repo.


After initializing git and making some commits, I first added the two remotes:

github and codeberg respectively.

git remote add codeberg ssh://git@codeberg.org/user/project.git
git remote add github git@github.com:user/project.git

Then, I set up origin so that it fetches from codeberg but pushes to both codeberg and github.

To set the fetch URL to point to codeberg:

git remote add origin ssh://git@codeberg.org/user/project.git

Then, to add both codeberg and github as push URLs:

git remote set-url --add --push origin ssh://git@codeberg.org/scientiac/interpretingo.git
git remote set-url --add --push origin git@github.com:scientiac/interpretingo.git

To verify that everything works properly I checked it by running the following command:

git remote show origin
* remote origin
  Fetch URL: ssh://git@codeberg.org/user/project.git
  Push  URL: ssh://git@codeberg.org/user/project.git
  Push  URL: git@github.com:user/project.git
  HEAD branch: master
  ...
  ...

Now, I have my project on both places so I can ignore github and enjoy the codeberg life.


Webmentions

Have you written a response to this? Let me know the URL, Or, you can send your response via mail:iac@scientiac.space