I have several remotes with different push
configurations; e.g.
[remote "public"]
url = ssh://external-server/repo
push = refs/heads/master:refs/heads/master
[remote "internal"]
url = ssh://internal-server/repo
push = refs/heads/*:refs/heads/*
Is it possible to push to both repositories with a single, simple command without inventing additional layers?
I tried pushUrl
as suggested in related questions but this expects an url and does not allow a remote. Then, I modified it to use git-remote-ext
like in
[remote "all"]
pushUrl = "ext::git push public"
pushUrl = "ext::git push internal"
But this pushes to the first repository only and fails then with
fatal: Could not read from remote repository.
Manual shell commands (git push public && git push internal
) are not a solution because in reality I have a lot of repositories which are having different sets of remotes (e.g. git servers hosted by customers, public repositories, internal/external mirrors, test systems, read-only sources). Sometimes they are in submodules which I want to push in a way like
git submodule foreach 'git push all'
Defining an alias might work but is too clumsy and breaks somehow the usual workflow (using git push
to push things).