I was looking for a way to keep more than one repository updated when I’m working on personal projects, don’t ask. So I found some useful information I’m going to post here for future reference.
Example part of a “.git/config” file:
[remote 'all']
url=ssh://user@server/repos/g0.git
url=ssh://user@server/repos/g1.git
url=ssh://user@server/repos/g2.git
url=ssh://user@server/repos/g3.git
With that “git push all” should push to all the remotes simultaneously.
If you have:
[branch 'master']
remote = g0
merge = refs/heads/master
[remote 'g0']
url = ssh://user@server/repos/g0.git
fetch = +refs/heads/*:refs/remotes/g0/*
Then “pulls” and "fetch"’s while on the master branch should only only target ssh://user@server/repos/g0.git.
Better yet:
[branch 'master']
remote = origin
merge = refs/heads/master
[remote 'origin']
url = ssh://user@server/repos/g0.git
fetch = +refs/heads/*:refs/remotes/g0/*
Then ssh://user@server/repos/g0.git is the default remote (“origin”) for pulls and fetches if no remote name is specified.